Should I store my images in the database or folders?


Possible Duplicate:
Storing Images in DB - Yea or Nay?


At the moment each Company on my website have 1 picture they can add to their profile. I save that image into the database....its their Company Logo.

Now i want to allow them to add more pictures. Now i don’t know if i must save it all in the database or save it in folders????

Reason why i think folders will be better is because there are so much nice articles with fancy silver light kinda features that i can use but all of them only cater for images saved in folders.

And since i am not THAT good its hard for me to change the code to look at the database instead of the examples that uses folders for image retrieval.

I would like to add something like this to my website (browsing through the images). Any code examples for me on how to do this when images are saved in the database? I am using ASP.NET with Click here to view what i am talking about

Any ideas guys?

Regards Etienne

5/23/2017 12:32:29 PM

Accepted Answer

I've done it both ways recently and personally; I do prefer using the directory method for storing the images while keeping their properties in a DB.

Main reason: I had client to whom I made a website for. On the Webiste; there was a Photo Gallery section that allowed the user to upload new photos (which could be browsed from the public site). Since my client hasn´t thought on optimizing the images before uploading; the *.jpg was over 1mb. I did implement the ability to update the image (once it was saved to the DB) but it had to be done one record at a time.

If this happens while storing the images in a directory, then the files can be saved locally, optimized and put back onto the server.

Here is an example

12/16/2018 8:17:50 PM

I'd go for folders. More flexibility if you run out of sttorage space (just move them to another disk and re-point), more flexibility with other apps (eg. Silverlight). I'd only use DB for files that had to be secure.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow