Image storage options #156
Replies: 2 comments
-
Would it be fine to make a storageservice that stores the images on the hard disk, with a reference UUID and store this UUID (resolves to the path of image on the disk) in the db of products? |
Beta Was this translation helpful? Give feedback.
-
Yes, it could work. Still I'd like to separate its implementation logic, abstracting to an interface that enables to use different, maybe multiple storage solutions at once. Problem is, I think I should work a little more on the API before, to make both ends comply. |
Beta Was this translation helpful? Give feedback.
-
It is simply a bad practice to store image uploads in databases, let alone passing their raw data through memory. This is why the
Image
entity class containsString url
andString filename
fields, but not something likebyte[] rawData
.If you ask me, I would recur to a SaaS solution that offers the ability to upload and deliver this content. But of course, there could cheaper solutions, like self-hosting a file server.
Regardless of the opted solutions, there needs to be integration code in place for anything to be used. And most importantly, there should be a simple Java API that makes it easy to switch implementations.
Beta Was this translation helpful? Give feedback.
All reactions