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.

width(int|float $width)

Sets the width of the asset.

height(int|float $height)

Sets the height of the asset.

aspectRatio(float|array ...$aspectRatio)

Sets the aspect ratio of the asset.

dpr(float $dpr)

Sets the device pixel ratio.

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(string|mixed $source)

Sets the overlay source.

underlay(string|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, string|array|mixed $value = null)

Sets the flag.

quality(int $level, null|string $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 $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.

bitRate(int|string $bitRate, null|string $type = null)

Controls the video bitrate.

fps(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

fpsRange(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

keyframeInterval(int $interval)

Sets the keyframe interval of the delivered video.

streamingProfile(string $streamingProfile)

Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.

videoSampling(int|string $value)

Sets the total number of frames to sample from the original video.

page(int|string|array|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.

defaultImage(string $defaultImage)

Default images can be used in the case that a requested image does not exist.

delay(int $delay)

Controls the time delay between the frames of an animated image, in milliseconds.

density(int|string $density)

Controls the density to use when delivering an image or when converting a vector file such as a PDF or EPS document to a web image delivery format.

prefix(string $prefix)

Prevents style class names collisions for sprite generation.

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 $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 Width width(int|float $width)

Sets the width of the asset.

Parameters

Name Type Description
$width int|float The width in pixels (if an integer is specified) or as a percentage (if a float is specified).

Return Value

Width

See also

Width

static Height height(int|float $height)

Sets the height of the asset.

Parameters

Name Type Description
$height int|float The height in pixels (if an integer is specified) or as a percentage (if a float is specified).

Return Value

Height

See also

Height

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

Sets the aspect ratio of the asset.

Parameters

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

Return Value

AspectRatio

See also

AspectRatio

static Dpr dpr(float $dpr)

Sets the device pixel ratio.

Parameters

Name Type Description
$dpr float The device pixel ratio.

Return Value

Dpr

See also

Dpr

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(string|mixed $source)

Sets the overlay source.

Parameters

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

Return Value

ImageSource

static ImageSource underlay(string|mixed $source)

Sets the underlay source.

Parameters

Name Type Description
$source string|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, string|array|mixed $value = null)

Sets the flag.

Parameters

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

Return Value

FlagQualifier

static QualityQualifier quality(int $level, null|string $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 int The level of the quality. (Range 1 to 100)
$preset null|string 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 $expression)

Sets up a conditional transformation.

Parameters

Name Type Description
$expression string 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 BitRate bitRate(int|string $bitRate, null|string $type = null)

Controls the video bitrate.

Supported codecs: h264, h265 (MPEG-4); vp8, vp9 (WebM).

Parameters

Name Type Description
$bitRate int|string The number of bits used to represent the video data per second. By default the video uses a variable bitrate (VBR), with this value indicating the maximum bitrate. The value can be an integer e.g. 120000, or a string supporting "k" and "m" (kilobits and megabits respectively) e.g. 250k or 2m.
$type null|string The type of bitrate. If "constant" is specified, the video plays with a constant bitrate (CBR). Use the constant defined in the BitRate class.

Return Value

BitRate

See also

BitRate

static Fps fps(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

Parameters

Name Type Description
$min int|null The minimum frame rate.
$max int|null The maximum frame rate.

Return Value

Fps

static Fps fpsRange(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

Parameters

Name Type Description
$min int|null The minimum frame rate.
$max int|null The maximum frame rate.

Return Value

Fps

static KeyframeInterval keyframeInterval(int $interval)

Sets the keyframe interval of the delivered video.

Parameters

Name Type Description
$interval int The keyframe interval in seconds.

Return Value

KeyframeInterval

static StreamingProfile streamingProfile(string $streamingProfile)

Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.

The value can be one of the pre-defined streaming profiles or a custom-defined one. You can use the streaming profiles methods of StreamingProfilesTrait to get a list of the available streaming profiles or to create new custom profiles.

Parameters

Name Type Description
$streamingProfile string The streaming profile.

Return Value

StreamingProfile

See also

StreamingProfilesTrait
https://cloudinary.com/documentation/video_manipulation_and_delivery#predefined_streaming_profiles

static VideoSampling videoSampling(int|string $value)

Sets the total number of frames to sample from the original video.

Relevant when converting videos to animated GIF or WebP format. If not specified, the resulting GIF or WebP samples the whole video (up to 400 frames, at up to 10 frames per second). By default the duration of the animated image is the same as the duration of the video, no matter how many frames are sampled from the original video (use the delay qualifier to adjust the amount of time between frames).

Parameters

Name Type Description
$value int|string Integer - The total number of frames to sample from the original video. The frames are spread out over the length of the video, e.g. 20 takes one frame every 5%. String - The number of seconds between each frame to sample from the original video. e.g. 2.3s takes one frame every 2.3 seconds.

Return Value

VideoSampling

static PageQualifier page(int|string|array|mixed $page)

Extracts the specified page(s).

Parameters

Name Type Description
$page int|string|array|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 DefaultImage defaultImage(string $defaultImage)

Default images can be used in the case that a requested image does not exist.

Parameters

Name Type Description
$defaultImage string Default image public ID

Return Value

DefaultImage

static Delay delay(int $delay)

Controls the time delay between the frames of an animated image, in milliseconds.

Parameters

Name Type Description
$delay int The delay in milliseconds

Return Value

Delay

static Density density(int|string $density)

Controls the density to use when delivering an image or when converting a vector file such as a PDF or EPS document to a web image delivery format.

Parameters

Name Type Description
$density int|string The density in dpi.

Return Value

Density

static Prefix prefix(string $prefix)

Prevents style class names collisions for sprite generation.

Parameters

Name Type Description
$prefix string The style class name prefix.

Return Value

Prefix

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 $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 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