Hey everyone! I'm adding a new feature to my web app where users can upload images directly to an object storage system. I want them to be able to download various sizes of the original image (like small, medium, and large) in optimized formats like WebP. I've been looking into a few different options:
- Cloudinary and Imgix seem to be on the pricier side.
- Cloudflare R2 with Cloudflare Images looks promising.
- Using Cloudflare R2 with AWS Lambda for processing images, but I'm worried about egress costs.
I also recently found Bunny.net, which offers a CDN, image optimization, and built-in storage. I'm still checking their pricing. What do you all think would be the most cost-effective solution?
5 Answers
I believe combining Cloudflare R2 with Cloudflare Images is a solid choice. You’ll have storage, automatic variants, and WebP conversion with fixed costs. Cloudinary and Imgix can add up fast, and creating your own setup with AWS Lambda often ends up being more complicated and expensive.
If you're already using Cloudflare, their image product is a great deal! It's only $5 a month for up to 100k images, and it handles resizing and optimization automatically. While using S3 with AWS Lambda for processing can work, it requires more ongoing maintenance and may not be worth the hassle.
I think it depends on how much you need to tweak your setup. Once everything is configured, there shouldn’t be much maintenance involved.
I've tackled this by doing it all manually in my projects. Recently, I created a Rust app to handle image scaling and turned it into a WebAssembly module. It integrates seamlessly into your app, allowing for client-side processing and direct uploads to an S3-compatible object store, which means my server only manages asset paths! Check out my GitHub if you're interested: [Local-Cafe](https://github.com/Local-Cafe/localcafe-full) and [Attack Blob](https://github.com/fullstack-ing/attack-blob).
You could also check out [skillsyncs.com](https://skillsyncs.com); they offer some interesting solutions for this kind of setup.
Have you considered Contabo for storage? It might be a good option to look into.

But what’s the advantage of storing images in R2 instead of using their image service directly? Is there some cost benefit?