Problem combining Cloudflare images and Cloudflare Image resizing

Hi,

I’m trying to use a worker to draw an overlay over an image found on Cloudflare Images.
I’m using a version of the example worker (bottom on page) from here in my testing: https://developers.cloudflare.com/images/image-resizing/resize-with-workers

Anyway, to the problem:
If I’m using an image that is not on Cloudflare Images everything works fine. However, if I’m using an image from there, it can only show the original image. As soon as I try to enter anything into {image: …}, I get an error message.
“ERROR 9401: Missing or invalid resizing parameters: missing variant key”

What does this message mean, and how do I fix it?

Best regards.

The message seems to mean that there is no extension (.jpg etc) in the Cloudflare Images link and it can’t figure out what it is. If I download the file and host it somewhere else, it does work.

I have a few workaround ides in my head, but if anyone have a way to provide a hint or something similar directly into the cf json, that would be nice.

As it’s been a couple of days on this, I didn’t think both products were meant to be used together. “Images” already offers something like resizing with the Variant option.

Is there a way to change the routing on Workers or within the Worker itself to not attempt a resize on an “Image”?

“As it’s been a couple of days on this, I didn’t think both products were meant to be used together. “Images” already offers something like resizing with the Variant option.”
Yeah, but I need to apply an overlay to one of the variants, and there is no support for that.

As far as I understand it, no resizing is done if you don’t supply height or width. In my tests I only added enough for an overlay to appear, which is all I want, and that seemed to work (ie no height/width). But the problem is that by not having that extension in the url (eg .jpg), it just didn’t work.

My current idea is just to download and return that image on another url, which does work, but everything is obviously not done on CF then. I don’t know enough about workers to know if something like that would be possible using only the worker.

1 Like