Apologies in advance if this is a silly question, but for me it is not clear from the documentation.
We have Cloudflare Polish enabled on our plan, and I want to make use of serving images with webp/avif encoding.
It seems that simply requesting images from our CMS (which is Sitecore) does not result in any webp/avif encoding being applied e.g. https://example.com/-/media/images/sample.jpg.
If I request the image via https://example.com/cdn-cgi/image/format=auto/https://example.com/-/media/images/sample.jpg then the encoding is applied. The documentation makes it seem like Cloudflare Image Resizing and Cloudflare Polish are two separate features, but from what I can see, they both need to go via the /cdn-cgi/ path for the conversion to take place. Is this correct?
They’re two separate services. Polish is more-or-less set-and-forget, but Image Resizing needs to be implemented however you choose to.
Thanks for your reply. I get that they are two separate services, but does Polish need to be utilised by requesting images through the /cdn-cgi/ path (as is definitely the case for Image Resizing). Or is there some other option available for Polish?
No, that’s what I’m saying. Polish is more-or-less a set-and-forget type of thing, unlike Image Resizing.
Polish is a one-click image optimization product that automatically optimizes images in your site. Polish will not be applied to URLs using Image Resizing.
Be sure that you’ve purged all of the relevant images from your cache. Otherwise, Polish won’t do anything with them as you’ll be seeing the old cached images.
Activate Polish · Cloudflare Image Optimization docs
With that said, with Image Resizing you’re forcing it to format the image as per the options you feed it. However, with Polish, it creates and caches a WebP version of the image and delivers it to the browser if the ‘Accept’ header from the browser includes WebP and the compressed image is significantly smaller than the lossy or lossless compression.
No. Your image URL won’t change, and that includes the file extension. So a file
example.com/image.jpg will not change to
Look for the header
Content-Type instead to make sure Polish has been applied. If a JPEG image is converted to WebP or AVIF, the header will show it.
CF-Polish will give you more details. Also, please note that Polish will not be applied to images with a “no-transform” directive in the
Great, that’s good news for me.
Thanks for confirming!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.