[thelist] Images--database or file

Mark Groen evolt at markgroen.com
Mon Feb 5 11:02:02 CST 2007


On Sunday 04 February 2007 21:10, john at johnallsopp.co.uk wrote:

> I'm in the habit of storing them in a directory and just holding a
> file name in the database.
>
> Currently the table's 250MB in size and I'm having problems uploading
> that to a new hosting account, so that's one downside of that method.
>
> Which way is best, tho? What are the advantages of storing images in a
> database? Or was I more rightererer than he?

methinks you are more righterer, there should be an extra performance hit as 
well on your server by not storing the images seperate from the db - the 
bigger a db table gets (doubt that you are making a key index on the image 
itself?) the longer/more it has to work retrieving your data.

Also, think of this scenario:
In your application you have a configuration file most likely, add the path to 
the image directory, storing just the image name in the db. Next time a major 
structural change takes place, there is only one line in one file to fix.
-- 
cheers,

        mark



More information about the thelist mailing list