Should I Save Images to Database or File System
It's been an issue for some time for developers the question of whether to save images on database or on file system. I decided to write this article to explain the pros and cons of both sides.
Saving Images To File System
Saving images to file system seems to be the best approach for some reasons. Images stored on file systems are easy to manage. When you need to retrieve the images, you just retrieve the path from your database and then load the image from there. They can also be easily previewed and this method separates your database information from image data. The down side of using file system to store images are the following:
* File system images can easily be renamed or deleted.
* File system images are susceptible to virus corruption (especially if you are running Windows)
* If your application is a web application, additional security measures must be done to secure images from unauthorized copying, linking etc...
Saving Images To Database
Images stored on database tables is applicable for images where database size is not a major concern, usually for applications which is expected to have just a minimum amount of information and would not require large concurrent connections. This gives you a centralized storage for all your applications resources. But for application which requires large amount of information, the database approach must be avoided for the following reasons:
* Saving images to tables bloats your database reducing performance
* Storing and retrieving images to tables requires additional programming techniques for converting images to byte array data and vice-versa.
* Images on database cannot be easily previewed.
* Dump files for your SQL Tables would consume large disk space.
* When databases are not well-structured and not maintained properly, bulky images can cause table/database corruption.
It is up to you whether to use the file system or the database approach. To me, I usually prefer the file system approach.
Comments
Yes you are right. This is
Yes you are right. This is always what I am saying to those who choose to ask this kind of question.
Thanks for this article.
By the way I will create a program on how to save and retrieve images to database. You can use this program if you have few images to store in your database.
But do not use this if you have a lot of images as what arjay have said.
thanx
nice post dear
Small or Big Application?
If the application is big, and the size of images keep increasing daily, will you still using filesystem? What do you think, flick, myspace or facebook using? Filesystem or database to store the images?
offcource
just take data type of ms access database OLE object , in sql server there is option of image field
re:
database is an organized collection of data, today typically in digital form. The data are typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports processes requiring this information (for example, finding a hotel with vacancies). See more at this site for further reading www.skilch.com
gorio
www.skilch.com
file system
thanks for this article its great but please how I can use file system? Explain
Add new comment