Page 1 of 1

PHP Images and MYSQL

Posted: Tue Mar 27, 2007 10:43 am
by tbrown1
Ok i think I probably know the answer to this but I will ask to see what other people think.

Which would be a better way to store uploaded photos for a gallery that contains a row for each photo
Would it be better to store the image in the database or just store the filename of the image in the database and the image in a folder on the web server.
I am guessing it is probably better to store the image in a folder on the webserver do to the extra processing power I would think is involved in pulling the image from the database and then recreating it but maybe their is something I am missing here
Tim

Posted: Tue Mar 27, 2007 10:55 am
by aaronhall
With files in general, it's almost always better to store files in the file system and store their references in the database. With images, the reference is probably always going to be placed in an IMG tag, and the only server-side processing required is to get that reference out of the database and print out the HTML.