TextSource
class TextSource extends BaseSource implements ImageTransformationInterface
Defines how to manipulate a text layer.
Learn more: Adding text captions
Methods
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
Custom resize builder.
Applies delivery action.
Deliver the image in the specified device pixel ratio.
Delivers the image as an attachment.
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.
Keeps the copyright related fields when stripping meta-data.
Keeps all meta-data.
Instructs Cloudinary to clear all ICC color profile data included with the image.
Inject a custom function into the image transformation pipeline.
Applies a filter or an effect on an asset.
Applies adjustment effect on an asset.
Applies a pre-defined named transformation of the given name.
Adds a generic qualifier as a separate action.
Adds action defined as an array of qualifiers.
Adds a flag as a separate action.
Rotates the asset by the given angle.
Specifies a conditional transformation whose condition should be met before applying a transformation.
Instruct Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
Sets the delay between frames of an animated image in milliseconds.
Default images can be used in the case that a requested image does not exist.
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.
Prevents style class names collisions for sprite generation.
Extracts selected pages/frames from the asset.
Extracts selected layers/embedded objects from the PSD file.
Changes the shape of the image.
Rounds the specified corners of an image.
TextLayer constructor.
Sets the text.
Sets the text style.
Adds a small amount of padding around the text overlay string.
Returns an error if the text overlay exceeds the image boundaries.
Details
TransformationResizeTrait
resize(BaseResizeAction $resize)
Resize the asset using provided resize action
TransformationResizeTrait
scale(int|float|string|null $width = null, int|float|null $height = null, int|float|array $aspectRatio = null)
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
TransformationResizeTrait
crop(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)
Extracts a region of the given width and height out of the original image.
TransformationResizeTrait
fill(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null)
Creates an image with the exact given width and height without distorting the image.
This option first scales up or down as much as needed to at least fill both of the given dimensions. If the requested aspect ratio is different than the original, cropping will occur on the dimension that exceeds the requested size after scaling.
TransformationResizeTrait
genericResize(string $name, int|float|string|null $width = null, int|float|null $height = null)
Custom resize builder.
TransformationDeliveryTrait
delivery(mixed $delivery)
Applies delivery action.
TransformationDeliveryTrait
format(Format|string $format)
Forces format conversion to the given format.
(Formerly known as fetch format)
TransformationDeliveryTrait
quality(int|string|Quality $quality)
Controls compression quality. 1 is the lowest quality and 100 is the highest.
Reducing the quality is a trade-off between visual quality and file size.
TransformationDeliveryTrait
dpr(float|string $dpr)
Deliver the image in the specified device pixel ratio.
CommonTransformationFlagTrait
attachment(string $filename = null)
Delivers the image as an attachment.
CommonTransformationFlagTrait
forceIcc()
Adds ICC color space metadata to the image, even when the original image doesn't contain any ICC data.
CommonTransformationFlagTrait
forceStrip()
Instructs Cloudinary to clear all image meta-data (IPTC, Exif and XMP) while applying an incoming transformation.
CommonTransformationFlagTrait
getInfo()
Returns metadata of the input asset and of the transformed output asset in JSON instead of the transformed image.
CommonTransformationFlagTrait
immutableCache()
Sets the cache-control to immutable for the asset.
CommonTransformationFlagTrait
keepAttribution()
Keeps the copyright related fields when stripping meta-data.
CommonTransformationFlagTrait
keepIptc()
Keeps all meta-data.
CommonTransformationFlagTrait
stripProfile()
Instructs Cloudinary to clear all ICC color profile data included with the image.
TransformationCustomFunctionTrait
customFunction(CustomFunction $customFunction)
Inject a custom function into the image transformation pipeline.
CommonTransformationTrait
effect(EffectQualifier|EffectAction $effect)
Applies a filter or an effect on an asset.
CommonTransformationTrait
adjust(EffectQualifier|EffectAction|AdjustmentInterface $adjustment)
Applies adjustment effect on an asset.
CommonTransformationTrait
namedTransformation(string|NamedTransformation $transformationName)
Applies a pre-defined named transformation of the given name.
CommonTransformationTrait
addGenericQualifier(string $shortName, array|mixed ...$value)
Adds a generic qualifier as a separate action.
CommonTransformationTrait
addActionFromQualifiers(array $qualifiers)
Adds action defined as an array of qualifiers.
CommonTransformationTrait
addFlag(FlagQualifier|string $flag)
Adds a flag as a separate action.
CommonTransformationTrait
addVariable(string|Variable $name, mixed $value = null)
Defines an new user variable.
CommonTransformationTrait
rotate(string|int $angle)
Rotates the asset by the given angle.
CommonTransformationTrait
conditional(Conditional $conditionalTransformation)
Specifies a conditional transformation whose condition should be met before applying a transformation.
ImageTransformationFlagTrait
sanitize()
Instruct Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
ImageQualifierTransformationTrait
delay(Delay|int $delay)
Sets the delay between frames of an animated image in milliseconds.
$this
defaultImage(string $defaultImage)
Default images can be used in the case that a requested image does not exist.
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.
Prefix
prefix(string $prefix)
Prevents style class names collisions for sprite generation.
LayeredImageTransformationTrait
extract(PageQualifier|string|int ...$pages)
Extracts selected pages/frames from the asset.
LayeredImageTransformationTrait
psdTools(PageQualifier|string|int ...$pages)
Extracts selected layers/embedded objects from the PSD file.
ImageSpecificTransformationTrait
overlay(string $layer, Position|AbsolutePosition $position = null, string $blendMode = null)
Adds an overlay over the base image.
ImageSpecificTransformationTrait
underlay(string $layer, Position|AbsolutePosition $position = null, string $blendMode = null)
Adds an underlay under the base image.
ImageSpecificTransformationTrait
reshape(ReshapeQualifier|EffectAction|EffectQualifier|mixed $reshape)
Changes the shape of the image.
ImageSpecificTransformationTrait
roundCorners(int|string|CornerRadius $radiusOrTopLeft, int $topRight = null, int $bottomRight = null, int $bottomLeft = null)
Rounds the specified corners of an image.
Only $radiusOrTopLeft specified: All four corners are rounded equally according to the value.
Only $radiusOrTopLeft and $topRight specified: Round the top-left & bottom-right corners according
to $radiusOrTopLeft, round the top-right & bottom-left corners according to $topRight.
Only $radiusOrTopLeft, $topRight and $bottomRight specified: Round the top-left corner according
to $radiusOrTopLeft, round the top-right & bottom-left corners according to $topRight, round the bottom-right
corner according to $bottomRight.
All qualifiers specified: Each corner is rounded accordingly.
ImageSpecificTransformationTrait
border(Border $border)
Adds a border around the image.
ImageSpecificTransformationTrait
backgroundColor(Background|ColorValue|string $color)
Sets the color of the background.
ImageSpecificTransformationTrait
background(Background|string $background)
Sets the image background.
ImageSpecificTransformationTrait
colorSpace(ColorSpace|string $colorSpace)
Controls the color space used for the delivered image.
ImageSpecificTransformationTrait
animated(AnimatedEdit $animated)
Applies animated image transformation action.
__construct(string $text = null, string|TextStyle $style = null, string $color = null, string|Background|ColorValue $backgroundColor = null)
TextLayer constructor.
$this
text(string $text)
Sets the text.
$this
textStyle(string|array|TextStyle $style)
Sets the text style.
$this
noTrim()
Adds a small amount of padding around the text overlay string.
$this
disallowOverflow()
Returns an error if the text overlay exceeds the image boundaries.
TextSource
stroke(string|BorderQualifier $stroke = Stroke::STROKE)
Sets whether to include an outline stroke.