class Rotate extends BaseAction implements RotationDegreeInterface, RotationModeInterface

Rotates or flips an image or video by the specified number of degrees, or automatically (images only) according to its orientation or available metadata.

Learn more: Rotating images | Rotating videos

Methods

__construct(mixed ...$degree)

Rotate constructor.

addQualifier(BaseComponent $qualifier = null)

Adds the qualifier to the action.

addQualifiers(array ...$qualifiers)

Adds qualifiers to the action.

setGenericAction(string $action)

Adds (sets) generic (raw) action.

setFlag(FlagQualifier $flag, bool $set = true)

Sets the flag.

unsetFlag(FlagQualifier $flag)

Removes the flag.

importAction(BaseAction|null $action)

Imports (merges) qualifiers and flags from another action.

jsonSerialize()

Serializes to json.

__toString()

Serializes to Cloudinary URL format

deg90()

Rotate image 90 degrees clockwise.

deg180()

Rotate image 180 degrees.

deg270()

Rotate image 90 degrees counterclockwise.

byAngle(int|array ...$degree)

Rotate an image by the given degrees.

autoRight()

Rotate image 90 degrees clockwise only if the requested aspect ratio does not match the image's aspect ratio.

autoLeft()

Rotate image 90 degrees counterclockwise only if the requested aspect ratio does not match the image's aspect ratio.

verticalFlip()

Vertical mirror flip of the image.

horizontalFlip()

Horizontal mirror flip of the image.

ignore()

By default, the image is automatically rotated according to the EXIF data stored by the camera when the image was taken. Set the angle to 'ignore' if you do not want the image to be automatically rotated.

mode(string|RotationMode|array ...$mode)

Rotate an image using the given mode.

setAngle(mixed ...$degree)

Sets the rotation angle.

createWithDegree(mixed ...$degree)

Named constructor.

createWithMode(mixed ...$mode)

Named constructor.

Details

__construct(mixed ...$degree)

Rotate constructor.

Parameters

Name Type Description
...$degree mixed The degrees of the angle.

$this addQualifier(BaseComponent $qualifier = null)

Adds the qualifier to the action.

Parameters

Name Type Description
$qualifier BaseComponent The qualifier to add.

Return Value

$this

$this addQualifiers(array ...$qualifiers)

Adds qualifiers to the action.

Parameters

Name Type Description
...$qualifiers array The qualifiers to add.

Return Value

$this

BaseAction setGenericAction(string $action)

Adds (sets) generic (raw) action.

Parameters

Name Type Description
$action string The generic action string.

Return Value

BaseAction

$this setFlag(FlagQualifier $flag, bool $set = true)

Sets the flag.

Parameters

Name Type Description
$flag FlagQualifier The flag to set.
$set bool Indicates whether to set(true) or unset(false) the flag instead. (Used for avoiding if conditions all over the code)

Return Value

$this

$this unsetFlag(FlagQualifier $flag)

Removes the flag.

Parameters

Name Type Description
$flag FlagQualifier The flag to unset.

Return Value

$this

$this importAction(BaseAction|null $action)

Imports (merges) qualifiers and flags from another action.

Parameters

Name Type Description
$action BaseAction|null The action to import.

Return Value

$this

mixed jsonSerialize()

Serializes to json.

Return Value

mixed

string __toString()

Serializes to Cloudinary URL format

Return Value

string

static AngleTrait deg90()

Rotate image 90 degrees clockwise.

Return Value

AngleTrait

static AngleTrait deg180()

Rotate image 180 degrees.

Return Value

AngleTrait

static AngleTrait deg270()

Rotate image 90 degrees counterclockwise.

Return Value

AngleTrait

static AngleTrait byAngle(int|array ...$degree)

Rotate an image by the given degrees.

Parameters

Name Type Description
...$degree int|array Given degrees. (Range: 0 to 360, Default: 0).

Return Value

AngleTrait

static RotationModeTrait autoRight()

Rotate image 90 degrees clockwise only if the requested aspect ratio does not match the image's aspect ratio.

Return Value

RotationModeTrait

static RotationModeTrait autoLeft()

Rotate image 90 degrees counterclockwise only if the requested aspect ratio does not match the image's aspect ratio.

Return Value

RotationModeTrait

static RotationModeTrait verticalFlip()

Vertical mirror flip of the image.

Return Value

RotationModeTrait

static RotationModeTrait horizontalFlip()

Horizontal mirror flip of the image.

Return Value

RotationModeTrait

static RotationModeTrait ignore()

By default, the image is automatically rotated according to the EXIF data stored by the camera when the image was taken. Set the angle to 'ignore' if you do not want the image to be automatically rotated.

Return Value

RotationModeTrait

static RotationModeTrait mode(string|RotationMode|array ...$mode)

Rotate an image using the given mode.

Parameters

Name Type Description
...$mode string|RotationMode|array Given rotation mode.

Return Value

RotationModeTrait

setAngle(mixed ...$degree)

Sets the rotation angle.

Parameters

Name Type Description
...$degree mixed The degrees of the angle.

static Rotate createWithDegree(mixed ...$degree)

Named constructor.

Parameters

Name Type Description
...$degree mixed The degree of the angle.

Return Value

Rotate

static Rotate createWithMode(mixed ...$mode)

Named constructor.

Parameters

Name Type Description
...$mode mixed The rotation mode.

Return Value

Rotate

Constants

MAIN_QUALIFIER