Skip to content

Format

Sets the output format as a processing option. It is equivalent to the extension of the URL.

imgproxy: format (alias f) · Availability: all editions; the best format needs Pro

use SomehowDigital\ImgProxy\Url;
use SomehowDigital\ImgProxy\Option\Format;
$url = Url::create()
->source('https://example.com/image.jpg')
->options(new Format('webp'));
$url->build();
// _/f:webp/plain/https%3A%2F%2Fexample.com%2Fimage.jpg

The option appears in the URL as f:webp.

Parameter Type Default Description
$format FormatEnum|string required A FormatEnum case or its value, such as webp, avif or png.
  • Alternatively, pass the format to Url::build(), which appends it as an extension.

imgproxy reference