Skip to content

ImageTransforms

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\ImageTransforms
Since
4.0.0

Image Transforms helper.

View source

Public Methods

MethodDescription
createTransformFromString()Create an AssetImageTransform model from a string.
detectTransformFormat()Detect the auto web-safe format for the Asset. Returns null, if the Asset is not an image.
extendTransform()Extend a transform by taking an existing transform and overriding its parameters.
generateTransform()Generates an image transform for an asset.
getLocalImageSource()Get a local image source to use for transforms.
getTransformString()Get the transform string for a given asset image transform.
normalizeTransform()Normalize a transform from handle or a set of properties to an ImageTransform.
parseTransformString()Parses a transform string.
storeLocalSource()Store a local image copy to a destination path.

createTransformFromString()

Create an AssetImageTransform model from a string.

View source

Arguments

Returns

craft\models\ImageTransform

detectTransformFormat()

Detect the auto web-safe format for the Asset. Returns null, if the Asset is not an image.

View source

Arguments

Returns

string

Throws

extendTransform()

Extend a transform by taking an existing transform and overriding its parameters.

View source

Arguments

Returns

craft\models\ImageTransform

generateTransform()

Generates an image transform for an asset.

View source

Arguments

Returns

string – The temp path that the transform was saved to

Throws

getLocalImageSource()

Get a local image source to use for transforms.

View source

Arguments

Returns

string

Throws

getTransformString()

Get the transform string for a given asset image transform.

View source

Arguments

Returns

string

normalizeTransform()

Normalize a transform from handle or a set of properties to an ImageTransform.

View source

Arguments

  • $transform (mixed)

Returns

craft\models\ImageTransform, null

Throws

parseTransformString()

Since
4.4.0

Parses a transform string.

View source

Arguments

Returns

array

storeLocalSource()

Store a local image copy to a destination path.

View source

Arguments

Throws

Constants

ConstantDescription
TRANSFORM_STRING_PATTERN