tags:

views:

229

answers:

2

I have more then 1600 Images so what should i do , directly store in application or store in DB, Now am storing in Application and my application gets Hanged so please Help


Exact Duplicate: User Images: Database or filesystem storage?
Exact Duplicate: Storing images in database: Yea or nay?
Exact Duplicate: Should I store my images in the database or folders?
Exact Duplicate: Would you store binary data in database or folders?
Exact Duplicate: Store pictures as files or or the database for a web app?
Exact Duplicate: Storing a small number of images: blob or fs?
Exact Duplicate: [store image in filesystem or database?][7]

A: 

As with most issues, it's not as simple as it sounds. There are cases where it would make sense to store the images in the database.

  • You are storing images that are changing dynamically, say invoices and you wanted to get an invoice as it was on 1 Jan 2007?
  • The government wants you to maintain 6 years of history Images stored in the database do not require a different backup strategy. Images stored on filesystem do
  • It is easier to control access to the images if they are in a database. Idle admins can access any folder on disk. It takes a really determined admin to go snooping in a database to extract the images

On the other hand there are problems associated

  • Require additional code to extract and stream the images
  • Latency may be slower than direct file access
  • Heavier load on the web server

This answer is quoted from "Conrad"

MAK
A: 

As pointed out previously, it depends.

One of the most common practices is to decide on the basis of the images' size. For very small images, such as thumbnails, icons etc, you certainly store them in the DB, and you can store them as a field of an entity (say a contact).

For medium sized images, it still makes sense to store them in the DB. However, you have to decide by yourself what is a medium sized image (my threshold is 1 MByte), and you should store the image not as a field of an entity: you should create an image entity and a relation to the interested entity (say the contact).

Finally, very large images should not be stored in the DB. You store them on disk and store on the DB their pathnames. This is necessary owing to the different latency and access time of the hard disk versus the DB. Indeed, it is the DB fast access through indexes that allows you to store medium and small sized images in the DB, but huge images should be handled differently.

unforgiven