Cannot resize private images from Cloud Images via Cloud Workers

For Workes & Pages, what is the name of the domain?

img.geadev.com

What is the error number?

9404

What is the error message?

ERROR 9404: Could not fetch the image — the server returned HTTP error 404 Not Found

What is the issue or error you’re encountering

I’m trying to upload images to Cloud Images, and serve the image with Cloud Workers to add an overlay watermark on them.

What steps have you taken to resolve the issue?

  1. When I served the images with signatures without any transformation using Cloud Workers, it worked flawlessly
  2. When I tried to add the overlay draw, I got the ERROR 9429: Flexible variants are not enabled for the account
  3. When I enabled the flexible variants feature and retried, The error become ERROR 9404: Could not fetch the image — the server returned HTTP error 404 Not Found

What are the steps to reproduce the issue?

As described above

It sounds like you’re trying to use all the features. And that’s pretty cool. It may be that the specific combination you’re attempting isn’t (yet) possible.

Can you post example Worker code of what you’re trying to do?

I want my original images to be private, and serve an endpoint to access a public variant that have a watermark on. That feature cannot be accomplished via transformation with URLs, so I used this worker code. The results are as above.

    let imageURL = new URL(request.url);
    imageURL.host = 'imagedelivery.net'
    imageURL.hostname = 'imagedelivery.net'
    imageURL.pathname = imageURL.pathname.replace('design/', `${ACCOUNT_ID}/`)
    imageURL.pathname = imageURL.pathname.replace(/\.[^/.]+$/, '');
    imageURL.pathname += '/thumbnail'
    
    await generateSignedUrl(imageURL).then(sigURL => {
      imageURL = sigURL
    })
    return fetch(imageURL.toString(), {
      cf: {
        image: {
          draw: [
            {
              url: watermarkURL,
              width: 200,
              height: 200,
              opacity: 0.5
            }
          ],
        },
      },
    })
1 Like

Going back to basics, it looks like you can’t use Image Resizing on an Images source, though I got a 9524 for the 404 error. I do have Resize from any origin enabled.

I tried the cdn-cgi approach, and it also returned a 404 when I use anything from imagedelivery, even when it works fine with a regular image from anywhere else:

https://www.example.com/cdn-cgi/image/fit=scale-down,width=600/https://imagedelivery.net/ACCOUNT_HASH/IMAGE_ID/VARIANT_NAME

I suspect the only way forward for this is to submit a Feature Request to add the Overlay feature as an option for Variants.

1 Like

I think so, too. I’m going to go with the approach of using another storage first before returning to Cloud Images when they have done that feature.

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.