Error 9524 for extensionless images using Transform

I’m getting error 9524 for extensionless images using Cloudflare Images transform feature for external images.

  1. An example URL: https://{MY_CF_DOMAIN}/cdn-cgi/image/width=96,quality=75,format=auto,anim=false/https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/2c28bc4c-eb5c-468a-d8ea-bb94f30b7e00/rectcrop3
  2. It will return: Error 9524: image could not be resized (404)
  3. Even though the external URL https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/2c28bc4c-eb5c-468a-d8ea-bb94f30b7e00/rectcrop3 is an image (just extensionless).

custom path is a bit wrong for image delivery. Serve images from custom domains · Cloudflare Image Optimization docs

it has to be

https://{MY_CF_DOMAIN}/cdn-cgi/imagedelivery/BXluQx4ige9GuW0Ia56BHw/2c28bc4c-eb5c-468a-d8ea-bb94f30b7e00/rectcrop3

and to use flixible variants, you need to enable it Enable flexible variants · Cloudflare Image Optimization docs and then url can look like

https://{MY_CF_DOMAIN}/cdn-cgi/imagedelivery/BXluQx4ige9GuW0Ia56BHw/2c28bc4c-eb5c-468a-d8ea-bb94f30b7e00/width=96

NOTE: format and quality are not supported now in flexible variants.

Oh I see, my Next.js app has an image loader which transforms external images (by pointing them to Cloudflare Image’s transformer) but this particular “image” is already a link to a Cloudflare Image instance.

I guess I’ll make an exception in my app to not double-transform and pass in the transformation arguments to the original link.

My current Next.js image loader:

export default function cloudflareLoader({ src, width, quality }: { src: string; width: number; quality?: number }) {
    const params = [`width=${width}`, `quality=${quality || 75}`, 'format=auto', 'onerror=redirect', 'anim=false']
    return `https://{MY_CF_DOMAIN}/cdn-cgi/image/${params.join(',')}/${src}`
}

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