How to get images from R2 to CF images

Hey, I want to upload large images to R2 (average Image size ~20MB). How can I copy these images to CF images for delivery? Workers won't be able to handle this.
6 Replies
Chaika
Chaika10mo ago
What exactly are you trying to do? CF Images has a hard limit of 10 MB. You can serve images from your bucket with an R2 Custom Domain. If you need to resize them, I would use Image Transformations, which can work off images in your bucket and has a max size of 70 MB https://developers.cloudflare.com/images/transform-images/
Cloudflare Docs
Transform images · Cloudflare Image Optimization docs
Transformations let you optimize and manipulate images stored outside of the Cloudflare Images product. Transformed images are served from one of your …
onestyle
onestyleOP10mo ago
In my case R2 is only a temporary storage and eventually will delete images from R2 and keep the original images on AWS deep archive. I'm using R2 as my first distention because of the low egress, these images will need to be transferred to multiple destinations. I understand that CF images have a hard limit if 10mb that's why I'm asking if there is any way I can resize these images to be under 10mb so I can move them to CF images.
Chaika
Chaika10mo ago
Why use CF Images at all? You can achieve the same general effect of CF Images by using Image Resizing on top of R2, for example, this is an image resized by Image Resizing in an R2 Bucket: https://i.chaika.me/cdn-cgi/image/width=1800,quality=75,format=auto/e9ed1ae4adfe4c8d8ea938d1a3c7f67f You can use CF Image Resizing in Workers as well to prevent them from changing options and such, but you would also be paying for Workers on each Invocation CF Image Resizing only bills you once for each unique transformation in a 30 day period https://developers.cloudflare.com/images/pricing/ Then you could just keep the source in the bucket. To answer your original question, I'm not aware of any way to resize them so that they would always be under 10 MB, at least not easily with Image Resizing
Cloudflare Docs
Pricing · Cloudflare Image Optimization docs
Cloudflare Images lets you store, optimize, and deliver images from one unified API.
onestyle
onestyleOP10mo ago
I'm trynna delete the images from R2 because of the storage cost, I'll be storing a large number of images every month, so I wanna keep a version of the images on CF images for delivery and keep the original copy on AWS archive (1tb is ~$1). So images should be on R2 for 1 month then deleted from R2, in this case I need an easy and cheap way to deliver these images to clients.
guy
guy9mo ago
Hey @Chaika Could you give me a quick rundown on how you did this? I wanna use image resizing on R2 but since it merged with Images I don't know how to
Alcyone
Alcyone4w ago
Exactly, the docs are sht. Honestly, unless you are pro Cloudflare Dev, you have no idea how to achieve such simple tasks. Why are so few examples in docs? Like there is no single example on how to get image from private R2 and then serve this with transformations
Want results from more Discord servers?
Add your server