Page 1 of 1

Image files vs. image blobs

Posted: Wed Feb 28, 2007 3:15 pm
by chris12295
which is more efficient, creating a directory for each user and saving images as files in the directory, or saving the images as blobs in a database? It seems that blobs would be much better organized but maybe not so efficient?

Posted: Wed Feb 28, 2007 3:31 pm
by daedalus__
I would go with files and folders.

Posted: Wed Feb 28, 2007 3:42 pm
by Luke
yup... that's what they're for. Filesystems are for files. Databases are for data. :wink:

Posted: Wed Feb 28, 2007 3:56 pm
by Ambush Commander
Make sure you properly sniff the images and make sure they're actually what they claim to be.

Posted: Sun Mar 04, 2007 11:17 am
by Ollie Saunders
Store metadata in the database if you need to. Images belong in files yeah. You can get large amounts of data out of files a lot quicker than databases but there are many other reasons why files are better.

Posted: Sun Mar 04, 2007 12:41 pm
by Xoligy
ole wrote:Store metadata in the database if you need to. Images belong in files yeah. You can get large amounts of data out of files a lot quicker than databases but there are many other reasons why files are better.
Yup, that's what I do. You can then use "deny from all" in a.htaccess to prevent direct access to the files (PHP will still be able to access them). Storing images in the database can really slow things down, not to mention it's harder to backup etc.

Posted: Sun Mar 04, 2007 12:44 pm
by Ollie Saunders
Keep them outside of the document root if you want to prevent direct access. It is generally known to be a more reliable way to protect your files.