Currently, I’m working on a website project where I plan to feature two types of images: one for profile pictures (one-to-one with user profiles) and another for item images, which could include multiple images per item.
I’m using Spring Boot to communicate with MySQL for storing all the item-related data like names, descriptions, and so on. My question is: What would be the best way to store these images?
Should I store the images directly in MySQL, or is there a better solution? I’m curious whether storing images in the database is efficient or worth it.
I’ve been reading about something called BLOB (Binary Large Object), which seems like it could solve my issue. From what I understand, it allows you to store images directly in the database. However, I’d love to hear your opinion.
Or should i just store it somewhere else?
2
Answers
storing images in BLOB is possible but may not be the best option, because it will slow down the database performance, also you may encounter issues when trying to backup or restore the database due to its increasing size
I would recommend using cloud storage like S3, they usually provide some more options that can help you serve the images to the client, and resize the images…
local storage is also an option but may not be efficient in a cloud environment
I’ve recently had this same dilema.
your choices are to store in the database, or to store in a file system.
database
pros
cons
file system
pros
cons
for me I went with the Database option.