Flag
abstract class Flag implements CommonFlagInterface, LayerFlagInterface, ImageFlagInterface, VideoFlagInterface
Defines flags that you can use to alter the default transformation behavior.
Learn more: Image transformation flags | Video transformation flags
Methods
Delivers the image as an attachment.
Allows specifying only either width or height so the value of the second axis remains as is, and is not recalculated to maintain the aspect ratio of the original image.
Adds ICC color space metadata to the image, even when the original image doesn't contain any ICC data.
Instructs Cloudinary to clear all image meta-data (IPTC, Exif and XMP) while applying an incoming transformation.
Returns metadata of the input asset and of the transformed output asset in JSON instead of the transformed image.
Sets the cache-control to immutable for the asset, which tells the browser that the asset does not have to be revalidated with the server when the page is refreshed, and can be loaded directly from the cache.
Keeps the copyright related fields when stripping meta-data. Without this flag, Cloudinary's default behavior is to strip all meta-data when generating new image transformations.
Keeps all meta-data. Without this flag, Cloudinary's default behavior is to strip all meta-data when generating new image transformations.
Sets generic flag specified by name.
Used when delivering a video file as an image format that supports animation, such as animated WebP.
When used together with automatic quality (q_auto): allow switching to PNG8 encoding if the quality algorithm decides that it's more efficient.
When converting animated images to PNG format, generates an animated PNG from all the frames in the original animated file instead of only from the first still frame.
When converting animated images to WebP format, generate an animated WebP from all the frames in the original animated file instead of only from the first still frame.
Trims pixels according to a clipping path included in the original image (e.g., manually created using PhotoShop).
Trims pixels according to a clipping path included in the original image (e.g., manually created using PhotoShop) using an evenodd clipping rule.
Automatically use lossy compression when delivering animated GIF files.
When used with automatic fetch_format (f_auto): ensures that images with a transparency channel will be delivered in PNG format.
Generate PNG images in the PNG8 format.
Generates PNG images in the PNG24 format.
Generates PNG images in the PNG32 format.
Generates a JPG image using the progressive (interlaced) JPG format.
Reduces the image to one flat pixelated layer (as opposed to the default vector based graphic) in order to enable PDF resizing and overlay manipulations.
Instructs Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
Instructs Cloudinary to clear all ICC color profile data included with the image.
Generates TIFF images using LZW compression and in the TIFF8 format.
A qualifier that ensures that an alpha channel is not applied to a TIFF image if it is a mask channel.
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'.
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.
Trims pixels according to the transparency levels of a given overlay image.
Applies all chained transformations, until a transformation component that includes this flag, on the last added overlay or underlay instead of applying on the containing image.
Replaces the first image embedded in a PDF with the image stipulated as an overlay, instead of adding it as another overlay.
Splices the video stipulated as an overlay on to the end of the container video instead of adding it as an overlay.
Prevents Cloudinary from extending the image canvas beyond the original dimensions when overlaying text and other images.
By default, text overlays are trimmed tightly to the text with no excess padding. This flag adds a small amount of padding around the text overlay string.
Returns an error if the text overlay exceeds the image boundaries.
Tiles the added overlay over the entire image.
If the requested video transformation has already been generated, this flag works identically to Flag::attachment.
Deliver an HLS adaptive bitrate streaming file as HLS v3 instead of the default version (HLS v4).
Keep the Display Aspect Ratio metadata of the uploaded video (if it’s different from the current video dimensions).
Don't stream a video that is currently being generated on the fly. Wait until the video is fully generated.
Convert the audio channel to mono
Truncate (trim) a video file based on the start time defined in the metadata (relevant only where the metadata includes a directive to play only a section of the video).
Create a waveform image (in the format specified by the file extension) from the audio or video file.
Details
static FlagQualifier
attachment(string $filename = null)
Delivers the image as an attachment.
When the image's URL is accessed, tells the browser to save the image instead of embedding it in a page. You can optionally set the attachment's filename. If you don't specify a filename, then the original image’s filename will be used as the attachment filename (rather than the public_id) unless the discard_original_filename qualifier was set during the file upload.
static FlagQualifier
ignoreAspectRatio()
Allows specifying only either width or height so the value of the second axis remains as is, and is not recalculated to maintain the aspect ratio of the original image.
static FlagQualifier
forceIcc()
Adds ICC color space metadata to the image, even when the original image doesn't contain any ICC data.
static FlagQualifier
forceStrip()
Instructs Cloudinary to clear all image meta-data (IPTC, Exif and XMP) while applying an incoming transformation.
static FlagQualifier
getInfo()
Returns metadata of the input asset and of the transformed output asset in JSON instead of the transformed image.
When used with g_auto, the metadata includes the proposed g_auto cropping coordinates.
static FlagQualifier
immutableCache()
Sets the cache-control to immutable for the asset, which tells the browser that the asset does not have to be revalidated with the server when the page is refreshed, and can be loaded directly from the cache.
Currently supported only by Firefox.
static FlagQualifier
keepAttribution()
Keeps the copyright related fields when stripping meta-data. Without this flag, Cloudinary's default behavior is to strip all meta-data when generating new image transformations.
static FlagQualifier
keepIptc()
Keeps all meta-data. Without this flag, Cloudinary's default behavior is to strip all meta-data when generating new image transformations.
Note that this flag cannot be used in conjunction with the automatic quality transformation (q_auto).
static FlagQualifier
generic(string $name, mixed ...$args)
Sets generic flag specified by name.
static FlagQualifier
animated()
Used when delivering a video file as an image format that supports animation, such as animated WebP.
Plays all frames rather than just delivering the first one as a static image. Use this flag in addition to the flag or qualifier controlling the delivery format, for example f_auto or fl_awebp.
Note: When delivering a video in GIF format, it is delivered as an animated GIF by default and this flag is not necessary. To deliver a single frame of a video in GIF format, use the page qualifier.
static FlagQualifier
anyFormat()
When used together with automatic quality (q_auto): allow switching to PNG8 encoding if the quality algorithm decides that it's more efficient.
static FlagQualifier
animatedPng()
When converting animated images to PNG format, generates an animated PNG from all the frames in the original animated file instead of only from the first still frame.
Note that animated PNGs are not supported in all browsers and versions.
static FlagQualifier
animatedWebP()
When converting animated images to WebP format, generate an animated WebP from all the frames in the original animated file instead of only from the first still frame.
Note that animated WebPs are not supported in all browsers and versions.
static FlagQualifier
clip()
Trims pixels according to a clipping path included in the original image (e.g., manually created using PhotoShop).
static FlagQualifier
clipEvenOdd()
Trims pixels according to a clipping path included in the original image (e.g., manually created using PhotoShop) using an evenodd clipping rule.
static FlagQualifier
lossy()
Automatically use lossy compression when delivering animated GIF files.
This flag can also be used as a conditional flag for delivering PNG files: it tells Cloudinary to deliver the image in PNG format (as requested) unless there is no transparency channel - in which case deliver in JPEG format.
static FlagQualifier
preserveTransparency()
When used with automatic fetch_format (f_auto): ensures that images with a transparency channel will be delivered in PNG format.
static FlagQualifier
png8()
Generate PNG images in the PNG8 format.
static FlagQualifier
png24()
Generates PNG images in the PNG24 format.
static FlagQualifier
png32()
Generates PNG images in the PNG32 format.
static FlagQualifier
progressive(string $mode = null)
Generates a JPG image using the progressive (interlaced) JPG format.
This format allows the browser to quickly show a low-quality rendering of the image until the full-quality image is loaded.
static FlagQualifier
rasterize()
Reduces the image to one flat pixelated layer (as opposed to the default vector based graphic) in order to enable PDF resizing and overlay manipulations.
static FlagQualifier
sanitize()
Instructs Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
static FlagQualifier
stripProfile()
Instructs Cloudinary to clear all ICC color profile data included with the image.
static FlagQualifier
tiff8Lzw()
Generates TIFF images using LZW compression and in the TIFF8 format.
static FlagQualifier
ignoreMaskChannels()
A qualifier that ensures that an alpha channel is not applied to a TIFF image if it is a mask channel.
static FlagQualifier
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'.
static FlagQualifier
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.
static FlagQualifier
cutter()
Trims pixels according to the transparency levels of a given overlay image.
Wherever the overlay image is transparent, the original is shown, and wherever the overlay is opaque, the resulting image is transparent.
static FlagQualifier
layerApply()
Applies all chained transformations, until a transformation component that includes this flag, on the last added overlay or underlay instead of applying on the containing image.
static FlagQualifier
replaceImage()
Replaces the first image embedded in a PDF with the image stipulated as an overlay, instead of adding it as another overlay.
static FlagQualifier
splice()
Splices the video stipulated as an overlay on to the end of the container video instead of adding it as an overlay.
static FlagQualifier
noOverflow()
Prevents Cloudinary from extending the image canvas beyond the original dimensions when overlaying text and other images.
static FlagQualifier
textNoTrim()
By default, text overlays are trimmed tightly to the text with no excess padding. This flag adds a small amount of padding around the text overlay string.
static FlagQualifier
textDisallowOverflow()
Returns an error if the text overlay exceeds the image boundaries.
static FlagQualifier
tiled()
Tiles the added overlay over the entire image.
static FlagQualifier
streamingAttachment(string $filename = null)
If the requested video transformation has already been generated, this flag works identically to Flag::attachment.
However, if the video transformation is being requested for the first time, this flag causes the video download to begin immediately, streaming it as a fragmented video file.
In contrast, if the regular fl_attachment flag is used when a user requests a new video transformation, the download will begin only after the complete transformed video has been generated.
Most standard video players successfully play fragmented video files without issue.
static FlagQualifier
hlsv3()
Deliver an HLS adaptive bitrate streaming file as HLS v3 instead of the default version (HLS v4).
Delivering in this format requires a private CDN configuration.
static FlagQualifier
keepDar()
Keep the Display Aspect Ratio metadata of the uploaded video (if it’s different from the current video dimensions).
static FlagQualifier
noStream()
Don't stream a video that is currently being generated on the fly. Wait until the video is fully generated.
static FlagQualifier
mono()
Convert the audio channel to mono
static FlagQualifier
truncateTS()
Truncate (trim) a video file based on the start time defined in the metadata (relevant only where the metadata includes a directive to play only a section of the video).
static FlagQualifier
waveform()
Create a waveform image (in the format specified by the file extension) from the audio or video file.