Storing Images in MySQL-Database or on WebSpace - Advantages and Disadvantages
Question by Guest | 2015-05-05 at 13:04
At the moment, I am trying to create an entirely reworked website, so it is time to throw away old habits.
One of my old habits was to always and only store images on the web space respectively the file system of the server and never within a database.
However, as I have heard, it is also possible to directly save images using BLOB within a MySQL database and to retrieve them therefrom. But, should I do that? Which advantages and disadvantages are there? What about the performance? Or is my idea stupid and I should not consider this at all?
Related Topics
MySQL: Rename Name of a Database
Tip | 1 Comment
MySQL: CSV Export as automatic Download
Tutorial | 0 Comments
Reload Images, CSS, JS and Web Pages despite Browser Cache
Tip | 2 Comments
How to resize Image before Upload in Browser
Tutorial | 13 Comments
JavaScript: Change Image and Link every X Seconds
Question | 1 Answer
MySQL: CSV Export as File stored on the Server
Tutorial | 0 Comments
MySQL: Change minimum word length for full text search
Tip | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
In general, I would not recommend to store images within a database. Instead, I would always prefer the filesystem.
Of course, it always depends on the individual case, and of course, there are surely situations in which there are also arguments for storing in databases. Here are some considerations:
The only real advantage for the database is, that the data stay together (for example profile photos and profile data). This is a benefit for searching as well as for sharing and backup of the data.
When separating those things, you have to care about a corresponding link in the database (for example an additional column containing the filename or with renaming the images with the primary key from the database). When renaming one of the parts, it is hard to maintain the connection. You do not have this problem when storing the data together only in the database.
2015-05-05 at 15:06