ImageTransforms

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

Image Transforms helper.

View source (opens new window)

# Public Methods

Method Description
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 (opens new window)

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 (opens new window)

Arguments

Returns

string (opens new window)

Throws

# extendTransform()

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

View source (opens new window)

Arguments

Returns

craft\models\ImageTransform

# generateTransform()

Generates an image transform for an asset.

View source (opens new window)

Arguments

Returns

string (opens new window) – The temp path that the transform was saved to

Throws

# getLocalImageSource()

Get a local image source to use for transforms.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getTransformString()

Get the transform string for a given asset image transform.

View source (opens new window)

Arguments

Returns

string (opens new window)

# normalizeTransform()

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

View source (opens new window)

Arguments

  • $transform (mixed)

Returns

craft\models\ImageTransform, null (opens new window)

Throws

# parseTransformString()

Since
4.4.0

Parses a transform string.

View source (opens new window)

Arguments

Returns

array (opens new window)

# storeLocalSource()

Store a local image copy to a destination path.

View source (opens new window)

Arguments

Throws

# Constants

Constant Description
TRANSFORM_STRING_PATTERN