As usual, it depends. You need to consider the pattern of using images and what functions your DBMS provides.
Saving images in a database:
PROFI
- If images need to be associated with objects in your database (for example, by the user), the database can take care of maintaining this relationship. If, on the other hand, the images are not associated with anything in the database, you probably will not want to store them in the database.
- If your database supports it, you will be able to process files within a transaction (I believe that MS SQL 2008 supports this, I do not know if others do).
- If you need to store several versions of each image (say, because they change over time), this will probably be easier to do in the database than in the file system.
REDD
- You will heavily load the database.
- Backing up a database can take a long time.
Saving images to disk:
PROFI
- Creating backups is trivial
- Image verification, etc. only requires a file browser, no database client needed
REDD
- Keeping the database view of the image collection and the actual contents on disk in sync may not be trivial, depending on the operations you will perform on the images.
Of course, all these problems are especially relevant if you store a large number of images.
source share