Skip to content

MaxSourceResolution

Limits the resolution of the source. It overrides the imgproxy configuration.

imgproxy: max_src_resolution (alias msr) · Availability: all editions

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

The option appears in the URL as msr:50.

Parameter Type Default Description
$resolution int required Maximum resolution in megapixels, greater than 0.
  • Values below 1 throw an InvalidArgumentException.
  • imgproxy only honors this option when IMGPROXY_ALLOW_SECURITY_OPTIONS is enabled.

imgproxy reference