Assets

Assets are ...

Styles And Transformations

You can create styles and transformation to process your image before it's displayed/rendered.

Styles

A style is a combination of transformations in a specific order.

The available styles are to be managed on /admin/system/orm/model/ImageStyle.

You can expose an image style to the asset browser so users can adjust the image of the style.

Transformations

A transformation is a specific image process task.

The available transformations are to be managed on /admin/system/orm/model/ImageTransformation.

When creating a transformation, try to give it a meaningful name.
The names of transformations are not exposed to non-administrators.

eg. A crop transformation to 200px width and 100px height could be named crop-100x100.
This way you know what you are dealing with when managing the styles.

Check out ride-lib-image for more information about the default transformations.

Blur

Blurs your image.

This transformation has following options:

OptionTypeRequiredDefaultDescription
radiusintegerno10Blur radius

Crop

Crops your image by resizing it first to an optimal dimension.

This transformation requires the following options:

OptionTypeRequiredDefaultDescription
widthintegeryes---Width to crop to in pixels
heightintegeryes---Height to crop to in pixels
  • width: width to crop to in pixels
  • height: height to crop to in pixels

Flip

Flips your image over the X-axis and/or the Y-axis.

This transformation requires the following options:

OptionTypeRequiredDefaultDescription
modestringyes---Mode, can be horizontal, vertical or both

Grayscale

Converts your image to a grayscaled image.

This transformations has no options.

Resize

Resizes your image to fit a maximum width and/or height.

This transformation requires one of the following options:

OptionTypeRequiredDefaultDescription
widthintegeryes, if no height provided---Maximum width of the resulting image
heightintegeryes, if no width is provided---Maximum height of the resulting image

Watermark

Adds a watermark to your image.

This transformation has the following options:

OptionTypeRequiredDefault
watermarkstringyes---
xintegerno0
yintegerno0

Smarty Functions

image

Return the URL of a transformed image.

ParameterTypeRequiredDescription
srcstringyesSource url or file for this image.
defaultstringnoFallback for src parameter.
transformationstringnoName of the transformation.
varstringnoVariable name to assign this URL to.

⚠️ Transformations may require additional parameters.

{image src=$content->image var='image' transformation='blur'}
{image src=$content->image var='image' transformation='crop' width=200 height=100}

asset

Function to render an asset

ParameterTypeRequiredDescription
srcstring or AssetEntryyesAsset to render. Can be an id, a slug or an instance of AssetEntry
stylestringnoMachine name of the style
varstringnoVariable to assign the result to
{asset src="my-asset"}
{asset src=15 style="thumbnail"}