Ltloafer's avatar

Best way to store and serve images

I'm working on an app that needs to upload and store high quality images (probably around 10,000 in total). Many of these images are originally around 20-30mb in size which I can reduce significantly before storing but they still result in reasonable file sizes. They will appear in carousels (as part of a portfolio site) which will call the images dynamically - and I need to make the serving of the images as smooth as possible. So my question is how best to store and serve them? Spatie's medial library looks a very good option for uploading etc. Having looked at using AWS with cloudfront on the bucket it still appears to me that storing them in local storage will have much lower latency. Are there better options I'm missing? Thanks

0 likes
5 replies
Snapey's avatar

loading the images from aws via public links will be much faster than from your server.

Ltloafer's avatar

I'm using an S3 bucket with Cloudfront and using signed urls to serve the images. This is fine but I don't see much improvement when comparing them to using the server. Importantly, the images are not cached in the browser (I've tried Chrome and Firefox) as expected although the Cache-control is set. Any ideas why?

Thanks

jlrdw's avatar

I would only show one main image at a time, to the right for example I would have some thumbnails if user clicks on the thumbnail then that would replace the main image, etc.

Kind of like an image gallery.

Of course arrange screen as needed.

I don't see where they are actually stored would make that much of a difference.

thugic's avatar

You should consider using a dedicated service like Cloudinary

Please or to participate in this conversation.