Storing images in MSSQL vs Disk

107 views Asked by At

I am developing an inhouse application in C#.NET, based on an MSSQL database. Users can upload images linked to a specific entity. These images have usually around 4 to 5 MB and cannot be compressed for storage.

Right now these images are stored in the filesystem where the application is. There are lag issues when printing a subset of images, maybe 30. They are filtered via DB and loaded via locationstring I get from the DB and then

Sytem.Drawing.Image.FromFile(locationstring)

I can (and have to) resize the images for printing (400x255px), for viewing them in the application they need to have the original size and quality.

I am supposed to redesign the way pictures are stored and implement a feature where the user can change the entity an image is linked to (that one I already figured out).

I rename the images when they are stored via the application - they get a GUID as name - and the original names and which entity they belong to are stored in the DB. I was thinking about storing these images in the DB instead of the filesytem. They are in a directory where the users do not have access, so it wouldn't make any difference to them.

Does it make sense to store the images in the DB instead of the filesystem in this case?

Right now the application DB is MSSQL2008R2 but can be switched to MSSQL2014. MSSQL server and filesytem are hosted externally and accessed via Citrix. The application is also hosted via Citrix.

1

There are 1 answers

0
xrcwrn On BEST ANSWER

You shoud store images in disk and its path should be stored in database. If you want to re size image(use your C# codes) put it into another folder and store its path in db

For more detail you can see

Storing Images in DB - Yea or Nay?

PHP to store images in MySQL or not?