Storing Images in Database vs Folders

When storing images to use on a web site there are two directions you can take. You can store the images in a folder or store the images in a table. The decision on which way to use is not always cut and dry but I will provide an overview of the advantages and disadvantages on using both ways.



* You can delete and upload without needing any special tools (SQL, etc) * You save and name them and allow Search engines to crawl them. (File names need to be smart) * You can store the images in different folders for different purposes.


* If you have a lot of images it could get overwhelming to perform maintenance on them. (Say you want to remove the images for a particular grouping). * If you ever want to move the images then you have to move each file. * Once you start saving them in a specific location then you cannot easily change the location of the files in the future.



*All the images are in one place and you can add attributes as additional fields for classifications. (Tagging, captions, etc) *You do not have to worry about having images that you don’t know about. *Backing Up and testing is easier. Say you are developing a piece of code that requires images. Then if you want to have all the images locally for testing you would just download the .mdf instead of each image. * File folders are better organized. * Allows you to control the displaying of the images. (Set a field to show or disable and mark it accordingly)


* The database could get awfully large * You could not actually go and look at the images like you could if they are in a folder. * SEO is not optimized

In closing let me say that I use a little of both ways. I mostly use a database that holds the name of the file along with attributes, tagging, etc. but actually store the photo in a folder structure. If you need to delete then you can get the files in SQL that you want to delete and then actually go to the folder structure and delete them. If this becomes a problem then you could write a little script to read the database and then delete the images.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , | Posted under DotNet/Windows Hosting, Internet, Programming/Coding | RSS 2.0

Author Spotlight

David Bauernschmidt

I live in the historical triangle of Virginia where I am married with two daughters. I have spent over 13 years working for a Fortune 500 company in the computer area. I started in VB 6.0 and by the time I ended my employment I was supervising a development team where we built many web applications. When my first daughter was born I wanted to spend more time with her so I left and became a programmer analyst for local government as well as launch my own company. Since then I have grown James River Webs into a profitable web design and application company helping small businesses create a big presence on the internet. As an employee I have created web application used by citizens and other companies. I enjoy fly fishing, and spending time with my family. I also enjoy learning new approaches and development tools when it comes to developing applications.

Leave a Reply

Your email address will not be published. Required fields are marked *