Skip to content

Dpr

Multiplies the resulting dimensions by a device pixel ratio, for HiDPI screens.

imgproxy: dpr · Availability: all editions

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

The option appears in the URL as dpr:2.

Parameter Type Default Description
$ratio float required Device pixel ratio, greater than 0. 1 leaves the size unchanged.
  • Gravity offsets, watermark offsets and paddings are scaled as well.

imgproxy reference