0

I want to store images related to a particular row in my table, So my table is called spot, and each spot can have multiple images, should i just store the images in a folder on the server and then store a location to that folder in a column of that row called imagesLocation?

or should there be other information encorporated?

any ideas?

molleman
  • 2,934
  • 16
  • 61
  • 92

2 Answers2

0

Yes, you should store the file in the file system and the location of the file in the database. In my experience the database connectors perform very poorly on large pieces of binary data in the database.

You should store all the meta-information you need in the database so you don't need to rely on the OS for anything else than storing the raw bytes.

Mathias Schwarz
  • 7,099
  • 23
  • 28
0

You are on the right track - store the images on the file system (preferably where they can be seen by the web server), and store just a path to them in the database. This can greatly reduce I/O to your database server. Often you will just create a <img> tag with the path, so you can lead the loading/caching of these files to your webserver - which it is really good at.

Adam Rabung
  • 5,232
  • 2
  • 27
  • 42
  • should i store just a path to a folder (The folder would be based on a id of a spot.) , or will i create another table for multiple images and store their exact location in here. – molleman Jun 28 '11 at 13:19
  • If you had a naming convention /images// you could avoid storing anything related to images in the db. If they have to be all over the file system, a separate table for storing paths would probably be best. – Adam Rabung Jun 28 '11 at 13:55