abstract class BaseResizeAction extends BaseAction

Class BaseResizeAction

Methods

__construct(string|CropMode $cropMode, null $width = null, null $height = null)

BaseResize 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

width(int|string|Expression $width)

Sets the width of the asset.

height(int|string|Expression $height)

Sets the height of the asset.

size(string $size)

Sets the width and height of the asset.

aspectRatio(float|array|AspectRatio ...$aspectRatio)

Sets the aspect ratio of the asset.

fromParams(array $qualifiers)

Creates a new instance using provided array of qualifiers

resizeMode(string|FlagQualifier $resizeMode)

Sets the resize mode.

regionRelative()

Modifies percentage-based width & height qualifiers of overlays and underlays (e.g., 1.0) to be relative to the overlaid region. Currently regions are only defined when using gravity 'face', 'faces' or 'custom'.

relative()

Modifies percentage-based width & height qualifiers of overlays and underlays (e.g., 1.0) to be relative to the containing image instead of the added layer.

Details

__construct(string|CropMode $cropMode, null $width = null, null $height = null)

BaseResize constructor.

Parameters

Name Type Description
$cropMode string|CropMode The crop mode.
$width null Optional. Width.
$height null Optional. Height.

$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

DimensionsTrait width(int|string|Expression $width)

Sets the width of the asset.

Parameters

Name Type Description
$width int|string|Expression The width in pixels.

Return Value

DimensionsTrait

DimensionsTrait height(int|string|Expression $height)

Sets the height of the asset.

Parameters

Name Type Description
$height int|string|Expression The height in pixels.

Return Value

DimensionsTrait

$this size(string $size)

Sets the width and height of the asset.

Parameters

Name Type Description
$size string The size of asset expressed as "width x height".

Return Value

$this

DimensionsTrait aspectRatio(float|array|AspectRatio ...$aspectRatio)

Sets the aspect ratio of the asset.

Parameters

Name Type Description
...$aspectRatio float|array|AspectRatio The new aspect ratio, specified as a percentage or ratio.

Return Value

DimensionsTrait

static BaseResizeAction fromParams(array $qualifiers)

Creates a new instance using provided array of qualifiers

Parameters

Name Type Description
$qualifiers array The qualifiers.

Return Value

BaseResizeAction

BaseResizeAction resizeMode(string|FlagQualifier $resizeMode)

Sets the resize mode.

Parameters

Name Type Description
$resizeMode string|FlagQualifier The resize mode. Can be set to: relative or regionRelative.

Return Value

BaseResizeAction

See also

ResizeMode::relative
ResizeMode::regionRelative

BaseResizeAction regionRelative()

Modifies percentage-based width & height qualifiers of overlays and underlays (e.g., 1.0) to be relative to the overlaid region. Currently regions are only defined when using gravity 'face', 'faces' or 'custom'.

Return Value

BaseResizeAction

BaseResizeAction relative()

Modifies percentage-based width & height qualifiers of overlays and underlays (e.g., 1.0) to be relative to the containing image instead of the added layer.

Return Value

BaseResizeAction

Constants

MAIN_QUALIFIER