There are different pros and cons of saving images file into the database.
Saving Image Files in Database Pros & Cons:
Pros:
- Easy indexing/searching of image
- If you want to save and secure sensitive/confidential Images like employee face images.
- Integrity and consistency is good as the image save with data.
- A database backup will automatically backup the images too.
- Access to image is easy
Cons:
- Slow access to the image when you have more images
- Require more resources on the server.
- The database grows quickly consequently database backup will require more time.
Saving Image in File System Pros & Cons:
Pros:
- Enable quick access to the image,
- Easily viewable on the server through image viewer/browse.
- Performance is better even a large number of files are present.
- Easy backup
Cons:
- Deleting the record will require deleting the file separately.
- Low security of image.
- Data and file link inconsistency may happen
- No transactional control using SQL transaction.
- Searching/Indexing is difficult
Ref:
- https://teamtreehouse.com/community/storing-image-in-database-compare-with-storing-at-the-folder-server
- https://www.quora.com/Difference-in-storing-image-in-database-table-vs-storing-image-in-folder-and-save-its-path-in-database-Which-is-better-and-why-PHP
- https://habiletechnologies.com/blog/better-saving-files-database-file-system/
- ChatGPT
0 Comments