Storing IMages In Databases

Status
Not open for further replies.

d-tour

New Member
Hey all,

Query, when uploading images to a big site pulling its content from a DB do ye store the images in the database?

Personally, i have usually stored images in a seperate folder on my ftp and named them the primary key of the entry in my database. I use this method cos images will quickly eat up the db size.

Can anyone think of any issues with this method... the main one is that i use 2 seperate systems to access one piece of information, not a huge complaint but for consistancy its not ideal, and im curious if there are more issues ive overlooked?
 

dereko

New Member
I think file system for files and database for data. I'd stick with the way you suggested first. Serializing and un-serializing will be a bigger overhead than taking the file from a file system.
 

louie

New Member
I wouldn't store images in the database, but only the path to the folder.

E.G. if I have a product that can have more then 1 image, i create a form for uploading, and a separate db table to store the image name and product id, this way i could have as many images as i want per product.

On upload i always rename the images using random letter and numbers to avoid duplicates.

To display the images for a product you can use the Join query type making just one call to the db.
 

georgiecasey

New Member
I dunno, I store MP3s as blobs in a mysql database and it works well. The actual file in one table and all the metadata in another as the table. File location in the database can get messy I find.
 

jmcc

Active Member
It depends on the number of images involved and the sizes. Some filesystems have problems with large numbers of files in a directory so they might be an argument for the use of a db. However for most applications, storing the images on the filesystems with the link in the db is the best way.

Regards...jmcc
 
Status
Not open for further replies.
Top