GravityObjectWeight
Gravity on detected objects, with a weight for each class.
imgproxy: gravity (alias g) · Availability: imgproxy Pro only
use SomehowDigital\ImgProxy\Url;use SomehowDigital\ImgProxy\Option\GravityObjectWeight;
$url = Url::create() ->source('https://example.com/image.jpg') ->options(new GravityObjectWeight(['face', 2], ['person', 1]));
$url->build();// _/g:objw:face:2:person:1/plain/https%3A%2F%2Fexample.com%2Fimage.jpgThe option appears in the URL as g:objw:face:2:person:1.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
$values |
array ... |
— | Pairs of a class name and a weight. The weight defaults to 1 in imgproxy. |
A dash means the argument can be left out. Trailing arguments that are left out or null are dropped from the URL, while a null before a given argument leaves an empty slot, so the following arguments keep their position.
- Not allowed for
ExtendandExtendAspectRatio.