PHP Images and MYSQL

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
tbrown1
Forum Newbie
Posts: 17
Joined: Wed Oct 25, 2006 10:58 am

PHP Images and MYSQL

Post 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
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
Post Reply