class Position extends BasePosition

Class Position

Methods

offsetX(int|float|string $x)

Sets the x offset.

offsetY(int|float|string $y)

Sets the y offset.

offset(int|float|string $x = null, int|float|string $y = null)

Sets the x and y offset.

x(int|float|string $x)

Sets the x dimension of the point.

y(int|float|string $y)

Sets the y dimension of the point.

point(int|float|string $x = null, int|float|string $y = null)

Sets the x and y dimensions of the point.

northWest(array ...$args)

North west corner (top left).

north(array ...$args)

North center part (top center).

northEast(array ...$args)

North east corner (top right).

west(array ...$args)

Middle west part (left).

center(array ...$args)

The center of the image.

east(array ...$args)

Middle east part (right).

southWest(array ...$args)

South west corner (bottom left).

south(array ...$args)

South center part (bottom center).

southEast(array ...$args)

South east corner (bottom right).

xyCenter(array ...$args)

Sets the center of gravity to the given x & y coordinates.

compass(string $direction, array ...$args)

Creates a new instance of the CompassGravity class.

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()

absolute(int|float|string $x = null, int|float|string $y = null)

Absolute position on the canvas.

Details

$this offsetX(int|float|string $x)

Sets the x offset.

Parameters

Name Type Description
$x int|float|string The x offset.

Return Value

$this

$this offsetY(int|float|string $y)

Sets the y offset.

Parameters

Name Type Description
$y int|float|string The y offset.

Return Value

$this

OffsetTrait offset(int|float|string $x = null, int|float|string $y = null)

Sets the x and y offset.

Parameters

Name Type Description
$x int|float|string The x offset.
$y int|float|string The y offset.

Return Value

OffsetTrait

$this x(int|float|string $x)

Sets the x dimension of the point.

Parameters

Name Type Description
$x int|float|string The value of the x dimension.

Return Value

$this

$this y(int|float|string $y)

Sets the y dimension of the point.

Parameters

Name Type Description
$y int|float|string The value of the y dimension.

Return Value

$this

PointTrait point(int|float|string $x = null, int|float|string $y = null)

Sets the x and y dimensions of the point.

Parameters

Name Type Description
$x int|float|string The value of the x dimension.
$y int|float|string The value of the y dimension.

Return Value

PointTrait

static CompassGravity|CompassPosition northWest(array ...$args)

North west corner (top left).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition north(array ...$args)

North center part (top center).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition northEast(array ...$args)

North east corner (top right).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition west(array ...$args)

Middle west part (left).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition center(array ...$args)

The center of the image.

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition east(array ...$args)

Middle east part (right).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition southWest(array ...$args)

South west corner (bottom left).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition south(array ...$args)

South center part (bottom center).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition southEast(array ...$args)

South east corner (bottom right).

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity|CompassPosition xyCenter(array ...$args)

Sets the center of gravity to the given x & y coordinates.

Parameters

Name Type Description
...$args array Additional arguments.

Return Value

CompassGravity|CompassPosition

static CompassGravity compass(string $direction, array ...$args)

Creates a new instance of the CompassGravity class.

Parameters

Name Type Description
$direction string The gravity direction.
...$args array Additional arguments.

Return Value

CompassGravity

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.

Parameters

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

Return Value

FocalGravity

See also

https://cloudinary.com/documentation/advanced_facial_attributes_detection_addon#face_detection_based_cropping

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.

Parameters

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

Return Value

FocalGravity

See also

https://cloudinary.com/documentation/advanced_facial_attributes_detection_addon#face_detection_based_cropping

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.

Parameters

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

Return Value

FocalGravity

See also

https://cloudinary.com/documentation/advanced_facial_attributes_detection_addon#eyes_detection_based_cropping

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

static AbsolutePosition absolute(int|float|string $x = null, int|float|string $y = null)

Absolute position on the canvas.

Parameters

Name Type Description
$x int|float|string The x coordinate.
$y int|float|string The y coordinate.

Return Value

AbsolutePosition