Skip to content

GravityObject

Gravity on the objects of the given classes, as detected by imgproxy’s object detection.

imgproxy: gravity (alias g) · Availability: imgproxy Pro only

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

The option appears in the URL as g:obj:face:person.

Parameter Type Default Description
$values string ... — Object class names. All detected objects when omitted.

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 Extend and ExtendAspectRatio.

imgproxy reference