Skip to content

Width

Sets the width of the resulting image.

imgproxy: width (alias w) · Availability: all editions

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

The option appears in the URL as w:300.

Parameter Type Default Description
$width int required Width in pixels. 0 derives the width from the height and the aspect ratio.
  • With the force resizing type, 0 keeps the original width.

imgproxy reference