abstract class Qualifier

Defines how to apply a particular transformation.

Methods

cropMode(string $cropModeName)

Sets the crop mode.

zoom(float $zoom)

Controls how much of the original image surrounding the face to keep when using either the 'crop' or 'thumb' cropping modes with face detection.

x(int $x)

Sets the x position in pixels.

y(int $y)

Sets the y position in pixels.

effect(string $effectName, mixed ...$values)

Injects a custom function into the image transformation pipeline.

overlay(mixed $source)

Sets the overlay source.

underlay(mixed $source)

Sets the underlay source.

angle(int|string|array|mixed ...$degree)

Sets the angle of the rotation of the asset.

color(string $color)

Sets the color.

background(array ...$value)

Defines the background color to use.

border(array ...$value)

Adds a border around the image.

flag(string $flagName, mixed $value = null)

Sets the flag.

quality(mixed $level, string|null $preset = null)

Controls the compression quality for images and videos.

opacity(int $level)

Adjusts the opacity of the image and makes it semi-transparent.

cornerRadius(array ...$value)

Rounds the corners of an asset.

startOffset(mixed $startOffset)

Sets the starting position of the part of the video to keep when trimming videos.

endOffset(mixed $endOffset)

Sets the end position of the part of the video to keep when trimming videos.

duration(mixed $duration)

Sets the duration of the video to keep.

ifCondition(string|null $expression)

Sets up a conditional transformation.

audioCodec(string $audioCodec)

Sets the audio codec or removes the audio channel.

audioFrequency(string $audioFrequency)

Sets the audio sample frequency.

page(mixed $page)

Extracts the specified page(s).

format(string $format)

Sets the file format.

colorSpace(string $colorSpace)

Controls the color space used for the delivered image.

colorSpaceFromIcc(string $publicId)

Specifies the ICC profile to use for the color space.

gravity(mixed $gravity)

Determines which part of the image to keep when any part of the image is cropped. For overlays, this setting determines where to place the overlay.

namedTransformation(string $transformationName)

Applies a pre-defined transformation to the asset.

customFunction(string $source, string|null $type = null, bool $preprocess = false)

Injects a custom function into the image transformation pipeline.

generic(string $genericKey, mixed ...$value)

Sets any qualifier to any value.

Details

static CropMode cropMode(string $cropModeName)

Sets the crop mode.

Parameters

Name Type Description
$cropModeName string The crop mode. Use the constants defined in the CropMode class.

Return Value

CropMode

See also

CropMode

static Zoom zoom(float $zoom)

Controls how much of the original image surrounding the face to keep when using either the 'crop' or 'thumb' cropping modes with face detection.

Parameters

Name Type Description
$zoom float The zoom factor. (Default: 1.0)

Return Value

Zoom

static X x(int $x)

Sets the x position in pixels.

Parameters

Name Type Description
$x int The x position.

Return Value

X

static Y y(int $y)

Sets the y position in pixels.

Parameters

Name Type Description
$y int The y position.

Return Value

Y

static EffectQualifier effect(string $effectName, mixed ...$values)

Injects a custom function into the image transformation pipeline.

Parameters

Name Type Description
$effectName string The name of the effect.
...$values mixed The effect values.

Return Value

EffectQualifier

static ImageSource overlay(mixed $source)

Sets the overlay source.

Parameters

Name Type Description
$source mixed The source of the layer.

Return Value

ImageSource

static ImageSource underlay(mixed $source)

Sets the underlay source.

Parameters

Name Type Description
$source mixed The source of the layer.

Return Value

ImageSource

static Angle angle(int|string|array|mixed ...$degree)

Sets the angle of the rotation of the asset.

Parameters

Name Type Description
...$degree int|string|array|mixed The rotation degree and/or mode.

Return Value

Angle

static ColorQualifier color(string $color)

Sets the color.

Parameters

Name Type Description
$color string The color.

Return Value

ColorQualifier

static Background background(array ...$value)

Defines the background color to use.

This applies to various scenarios including: * Defining the color to use instead of transparent background areas when converting to a format that does not support transparency * Using the pad crop mode * Setting the color behind a text overlay * Setting the color behind subtitles

Parameters

Name Type Description
...$value array The background color. Can be set as an RGB or RGBA hex triplet or quadruplet, a 3- or 4-digit RGB/RGBA hex, or a named color.

Return Value

Background

static BorderQualifier border(array ...$value)

Adds a border around the image.

Parameters

Name Type Description
...$value array The color, width and style of the border. Currently, only solid is supported for style. Colors can be set as an RGB or RGBA hex triplet or quadruplet, a 3- or 4-digit RGB/RGBA hex, or a named color.

Return Value

BorderQualifier

static FlagQualifier flag(string $flagName, mixed $value = null)

Sets the flag.

Parameters

Name Type Description
$flagName string The name of the flag.
$value mixed An optional value of the flag.

Return Value

FlagQualifier

static QualityQualifier quality(mixed $level, string|null $preset = null)

Controls the compression quality for images and videos.

Reducing the quality is a trade-off between visual quality and file size.

Parameters

Name Type Description
$level mixed The level of the quality. (Range 1 to 100)
$preset string|null A set level of automatic quality. Use the constants defined in the QualityQualifier class.

Return Value

QualityQualifier

See also

QualityQualifier

static Opacity opacity(int $level)

Adjusts the opacity of the image and makes it semi-transparent.

Parameters

Name Type Description
$level int The level of opacity. 100 means opaque, while 0 is completely transparent (Range: 0 to 100).

Return Value

Opacity

static CornerRadius cornerRadius(array ...$value)

Rounds the corners of an asset.

Parameters

Name Type Description
...$value array The radius of the corner(s). See CornerRadius class for details.

Return Value

CornerRadius

See also

CornerRadius

static StartOffset startOffset(mixed $startOffset)

Sets the starting position of the part of the video to keep when trimming videos.

Parameters

Name Type Description
$startOffset mixed The starting position of the part of the video to keep. This can be specified as a float representing the time in seconds or a string representing the percentage of the video length (for example, "30%" or "30p").

Return Value

StartOffset

static EndOffset endOffset(mixed $endOffset)

Sets the end position of the part of the video to keep when trimming videos.

Parameters

Name Type Description
$endOffset mixed The end position of the part of the video to keep. This can be specified as a float representing the time in seconds or a string representing the percentage of the video length (for example, "30%" or "30p").

Return Value

EndOffset

static Duration duration(mixed $duration)

Sets the duration of the video to keep.

Parameters

Name Type Description
$duration mixed The length of the part of the video to keep. This can be specified as a float representing the time in seconds or a string representing the percentage of the video length (for example, "30%" or "30p").

Return Value

Duration

static IfCondition ifCondition(string|null $expression)

Sets up a conditional transformation.

Parameters

Name Type Description
$expression string|null The condition to meet in order to apply the transformation.

Return Value

IfCondition

See also

IfCondition
https://cloudinary.com/documentation/conditional_transformations Conditional transformations

static AudioCodec audioCodec(string $audioCodec)

Sets the audio codec or removes the audio channel.

Parameters

Name Type Description
$audioCodec string The audio codec or "none". Use the constants defined in the AudioCodec class.

Return Value

AudioCodec

See also

AudioCodec

static AudioFrequency audioFrequency(string $audioFrequency)

Sets the audio sample frequency.

Parameters

Name Type Description
$audioFrequency string The audio frequency. Use the constants defined in the AudioFrequency class.

Return Value

AudioFrequency

See also

AudioFrequency

static PageQualifier page(mixed $page)

Extracts the specified page(s).

Parameters

Name Type Description
$page mixed The page(s) to extract.

Return Value

PageQualifier

static FormatQualifier format(string $format)

Sets the file format.

Parameters

Name Type Description
$format string The file format.

Return Value

FormatQualifier

static ColorSpace colorSpace(string $colorSpace)

Controls the color space used for the delivered image.

Use the constants defined in \Cloudinary\Transformation\ColorSpace for $colorSpace.

Parameters

Name Type Description
$colorSpace string The color space. Use the constants defined in the ColorSpace class.

Return Value

ColorSpace

See also

ColorSpace

static ColorSpace colorSpaceFromIcc(string $publicId)

Specifies the ICC profile to use for the color space.

The ICC file must be uploaded to your cloud as a raw, authenticated file.

Alias for ColorSpace::icc

Parameters

Name Type Description
$publicId string The public ID (including the file extension) of the ICC profile that defines the color space.

Return Value

ColorSpace

See also

ColorSpace::icc

static GravityQualifier gravity(mixed $gravity)

Determines which part of the image to keep when any part of the image is cropped. For overlays, this setting determines where to place the overlay.

Parameters

Name Type Description
$gravity mixed The area of the image. Use the constants defined in any of the classes that extend GravityQualifier, such as CompassGravity or ObjectGravity.

Return Value

GravityQualifier

static NamedTransformation namedTransformation(string $transformationName)

Applies a pre-defined transformation to the asset.

Parameters

Name Type Description
$transformationName string The name of the transformation.

Return Value

NamedTransformation

See also

NamedTransformation

static CustomFunction customFunction(string $source, string|null $type = null, bool $preprocess = false)

Injects a custom function into the image transformation pipeline.

Parameters

Name Type Description
$source string Source of this custom function
$type string|null The type of custom function (CustomFunction::REMOTE or CustomFunction::WASM).
$preprocess bool Preprocess custom function. Only remote functions are supported for preprocess

Return Value

CustomFunction

See also

CustomFunction::REMOTE
CustomFunction::WASM

static GenericQualifier generic(string $genericKey, mixed ...$value)

Sets any qualifier to any value.

For future compatibility.

Parameters

Name Type Description
$genericKey string The name of any qualifier.
...$value mixed The value of the qualifier.

Return Value

GenericQualifier