Image Optimizer: Host in R2 Possible?

Hi all, We're working with a vendor on a new site and are trying to get image optimization in place as per their requests, but we currently store images in S3 (this is a wordpress site, using S3 as its media library). The cost for using S3 has ballooned over the last several years due to egress costs, so R2 looks like an attractive solution - but as I move further into setting up image optimization, it looks like that product would actually prefer us store the images there. I keep seeing conflicting (or incomplete) info in docs and in the community forums, so I'm hoping to get some context and info to help decide how to best implement this to maximize caching and optimization/resizing/transforms. Are we best served migrating out of S3 and into R2, and setting up workers to handle image optimizations via the Images product or should we migrate out of S3 into "Images" (or should we avoid migration altogether at this point and do something else to keep things moving forward)? Any insight is super helpful - thanks. Also, apologies if this is best posted to another channel, I didn't see a dedicated Images channel, but feel free to point me there if I missed it.
2 Replies
Chaika
Chaika•10mo ago
Hey, The quick answer would be it depends. You're trying to just do some basic optimization on images? You could use an R2 Custom Domain and get Pro (or higher) on a website and enable Cloudflare Polish (https://developers.cloudflare.com/images/polish/). Polish is completely free and would optimize images, supports webp and lossy or loseless compression. Really simple, not many options. If you need more complex transformations, you could use an R2 Custom Domain and Image Resizing/Transformations. They recently redid the price on those, $0.50 per 1k unique transformations per month. Unique meaning if you resize the same source image with the same parameter, it costs you no more to do one time then one billion times. Still a bit pricey though. https://blog.cloudflare.com/merging-images-and-image-resizing/ https://developers.cloudflare.com/images/transform-images/transform-via-url/ R2 is overall cheaper then Images plus you have S3-Compatiability, which is always helpful in terms of tooling. I think I would only recommend Images if you want more of its image focused features like direct upload (which you could do with s3 presigned), preset variants, easier managing/tagging and such. It's more a full pipeline/images solution, where R2 is cheaper because it's an object store. https://developers.cloudflare.com/r2/pricing/ Workers would be an extra cost there as well which I would avoid unless you really need it. If you're in Project Galileo per your intro post, CF may be able to sponsor Images, Resizing or R2, not too sure about that all though.
slothluvchunk
slothluvchunkOP•10mo ago
This is really helpful @Chaika - thank you. I'm trying to get some more info from our vendor (I think they thought this was just a toggle we'd implement, and not a massive library migration or refactor), but this helps frame the conversation a bit better. I may have more questions - but thanks for this 🙂
Want results from more Discord servers?
Add your server