Skip to content

MaxSourceFileSize

Limits the file size of the source. It overrides the imgproxy configuration.

imgproxy: max_src_file_size (alias msfs) · Availability: all editions

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

The option appears in the URL as msfs:10000000.

Parameter Type Default Description
$size int required Maximum size in bytes. 0 disables the limit.
  • Values below 0 throw an InvalidArgumentException.
  • imgproxy only honors this option when IMGPROXY_ALLOW_SECURITY_OPTIONS is enabled.

imgproxy reference