Cloudflare image size and format by device

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

example.com

What is the issue or error you’re encountering

How to Dynamically Change Image Size with Cloudflare Images?

What steps have you taken to resolve the issue?

Hi everyone,

As a junior developer, I was looking for a solution to avoid using srcset and hard-coding image transformations. I thought Cloudflare Images could offer this service, as mentioned on the Cloudflare Images homepage:

“Automatically deliver the best size and format by device and browser type, without hard-coding image transformations.”

However, I seem to be missing something because I can’t find a way to make the image sizes change automatically.

I’ve read the documentation and searched for guides or topics on the web, including on this forum, but I haven’t had any success. I’ve tried using variants and flexible variants with custom URLs, but still, the image size doesn’t seem to change based on the device’s width.

So, what am I missing? What are we supposed to do to make image sizes adjust dynamically?

Sorry for the lack of knowledge—I’m still learning. Any help would be appreciated!

Thank you!

Hello,

There are two different ways to use Images:

  • Efficiently store and deliver images. You can upload images into Cloudflare Images and dynamically deliver multiple variants of the same original image.
  • Optimize images that are stored outside of Images You can make transformation requests to optimize any publicly available image on the Internet.

Variants let you specify how images should be resized for different use cases. By default, images are served with a public variant, but you can create up to 100 variants to fit your needs. Follow these steps to create a variant.

For your information, Cloudflare Images can deliver SVG files but will not resize them because it is an inherently scalable format. Resize via the Cloudflare dashboard.

Kindly review this document for further information :

Thank you !

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