class FocalGravity extends GravityQualifier implements FocalGravityInterface

Defines the area to keep when automatically resizing an image.

Learn more: Focal gravity

Methods

advancedFace(mixed ...$fallback)

Detects the largest face in an image with the Advanced Facial Attribute Detection add-on and makes it the focus of the transformation.

advancedFaces(mixed ...$fallback)

Detects all faces in an image with the Advanced Facial Attribute Detection add-on and makes them the focus of the transformation.

advancedEyes(mixed ...$fallback)

Detects all eyes in an image with the Advanced Facial Attribute Detection add-on and makes them the focus of the transformation.

body(mixed ...$fallback)

Detects human bodies in the asset and makes them the focus of the transformation.

face(mixed ...$fallback)

Detects the largest face in the asset and makes it the focus of the transformation.

faces(mixed ...$fallback)

Detects all the faces in the asset and makes them the focus of the transformation.

noFaces(mixed ...$fallback)

Gives priority to areas of the asset that do not contain faces.

custom(mixed ...$fallback)

Uses custom coordinates that were previously specified (for example, as part of the image upload method) and makes them the focus of the transformation.

customNoOverride(mixed ...$fallback)

Crops the image while giving higher priority to custom coordinates (custom coordinates don't override the automatic cropping).

ocrText(mixed ...$fallback)

Detects all text elements in an image using the OCR Text Detection and Extraction add-on and uses the detected bounding box coordinates as the focus of the transformation.

ocr(mixed ...$fallback)

Alias for Gravity::ocrText()

__construct($focalGravity, array ...$fallBacks)

FocalGravity constructor.

Details

static FocalGravity advancedFace(mixed ...$fallback)

Detects the largest face in an image with the Advanced Facial Attribute Detection add-on and makes it the focus of the transformation.

For details, see the Advanced Facial Attribute Detection add-on documentation.

static FocalGravity advancedFaces(mixed ...$fallback)

Detects all faces in an image with the Advanced Facial Attribute Detection add-on and makes them the focus of the transformation.

For details, see the Advanced Facial Attribute Detection add-on documentation.

static FocalGravity advancedEyes(mixed ...$fallback)

Detects all eyes in an image with the Advanced Facial Attribute Detection add-on and makes them the focus of the transformation.

For details, see the Advanced Facial Attribute Detection add-on documentation.

static FocalGravity body(mixed ...$fallback)

Detects human bodies in the asset and makes them the focus of the transformation.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity face(mixed ...$fallback)

Detects the largest face in the asset and makes it the focus of the transformation.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity faces(mixed ...$fallback)

Detects all the faces in the asset and makes them the focus of the transformation.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity noFaces(mixed ...$fallback)

Gives priority to areas of the asset that do not contain faces.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity custom(mixed ...$fallback)

Uses custom coordinates that were previously specified (for example, as part of the image upload method) and makes them the focus of the transformation.

Defaults to 'center' gravity if no custom coordinates have been specified.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity customNoOverride(mixed ...$fallback)

Crops the image while giving higher priority to custom coordinates (custom coordinates don't override the automatic cropping).

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

static FocalGravity ocrText(mixed ...$fallback)

Detects all text elements in an image using the OCR Text Detection and Extraction add-on and uses the detected bounding box coordinates as the focus of the transformation.

For details, see the OCR Text Detection and Extraction add-on documentation.

Parameters

Name Type Description
...$fallback mixed Fallback gravities.

Return Value

FocalGravity

See also

https://cloudinary.com/documentation/ocr_text_detection_and_extraction_addon

static FocalGravity ocr(mixed ...$fallback)

Alias for Gravity::ocrText()

Parameters

Name Type Description
...$fallback mixed

Return Value

FocalGravity

See also

FocalGravity::ocrText

__construct($focalGravity, array ...$fallBacks)

FocalGravity constructor.

Parameters

Name Type Description
$focalGravity
...$fallBacks array