When are the images stored into database in application ?

  • Thread starter Thread starter Kylin
  • Start date Start date
K

Kylin

I want to make a Product post web application ,
and should I store the product image into database or save to a directory ?
which is better ?

and what about this in www.amazon.com ?

any one who can give me some advices ?
 
Kylin,

When they have as normal in a webpage the size of a thumbnail, I would store
them in the database.

When it are real images I would only store the path in the database.
Handling large bytearrays is in my opinion very slow wiht a database.

However,

Just my thought,

Cor
 
Having them inside allows to treat them as any other field. You gain
consistancy but it makes also backups slower because of the increased volume
and if you need anyway to extract those files...

For those reasons, storing outside the DB makes the best default choice.



Patrice
 
I store the images in a /images Dir and the thumbs in the
/images/thumbs Dir. I use a naming convention of image.jpg and
th_image.jpg. In the DB I just have the name of the image I want to
use and in code have it add "th_" for the thumbs. I wrote a small
management app that hadles the deleting of items from the DB and will
automatically go and kill the image and it's thumb. It also handles
the adding of an item and puting it's image and thumb in the proper
Dir's. I think putting images in the DB is ok for employee photos that
are little wallet size things, but if we're talking products, I just
think it will make a very bloated DB. Plus you could have the image
name be a version of the items name and also have other things
available like pdf manuals in a pdf dir, or all kinds of things.

my 2 cents,
Norst
 
Back
Top