Got Error 9412 when intergate with cloudflare transform-images

Here is my origin image https://pub-ca47892bad5a4ac188639b2876730708.r2.dev/test-imb%2F%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230922092202 I try to use cloudflare images transform-images feature to resize my origin image by: https://coolify.jokcy.fun/cdn-cgi/image/width=80https://pub-ca47892bad5a4ac188639b2876730708.r2.dev/test-imb%2F%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230922092202 I already enabled this feature on my zone: jokcy.fun, I got this error:
ERROR 9412: Could not resize the image: Unknown or unsupported file type
ERROR 9412: Could not resize the image: Unknown or unsupported file type
How can I make it work?
5 Replies
Chaika
Chaika4mo ago
You need a slash between the image options and the url, ex: https://coolify.jokcy.fun/cdn-cgi/image/width=80/https://pub-ca47892bad5a4ac188639b2876730708.r2.dev/test-imb%2F%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230922092202
https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>
It's still not going to work though because by default you cannot transform images outside of your zone (not hosted on jokcy.fun). But you shouldn't be using r2.dev for production anyway, I would recommend just adding a Custom Domain to jocky.fun like r2.jocky.fun and resizing off that
Chaika
Chaika4mo ago
Cloudflare Docs
Public buckets · Cloudflare R2 docs
Public Bucket is a feature that allows users to expose the contents of their R2 buckets directly to the Internet. By default, buckets are never …
Jokcy
Jokcy4mo ago
How to make it work to transform images outside of my zone? I have this kind of requirement.
Chaika
Chaika4mo ago
Sure, if you go to Images -> Transformations, find jocky.fun and enable "Resize from any origin". Either that or use a Cloudflare Worker and its resizing fetch options to further restrict what origins can be resized on (Workers can resize any origin without that checked)
Jokcy
Jokcy4mo ago
Thank you! Do you know there are any way to secure the transformation url? Seems anyone can use my url to optimize a image when I enable this option.