Using the transform parameter to automatically optimize the IntelligenceBank CDN linked asset

Modified on Sat, 24 Jan at 1:36 AM

CDN Transformations

When configuring your Templates, you can use a transform parameter to automatically optimize the IntelligenceBank CDN linked asset based on specific media queries, leveraging IntelligenceBank's transformation capabilities.

The query to use is transform:"{transformation_parameter}" - where transformation_parameter is the transformation parameter you want to use.

Using Presets

You can manually change the preset applied by inserting preset={id} (as displayed in the CDN URL):

@Html.IntelligenceBankMediaItem(Model, "ibImagePicker", htmlAttributes: new { width="500" }, transform: "preset=VOEb")

Manual Transformations

You can also apply manual transformations instead of using presets. See the available parameters that are supported.

For example, transform: "size=500x500" will resize the image to 500x500 pixels:

@Html.IntelligenceBankMediaItem(Model, "ibImagePicker", transform: "size=500x500")

Renders as:

young fitness woman runner running at sunrise seaside

Combining Parameters

Combine multiple parameters using the & character. For example, "size=400x400&crop=200x200&cropgravity=auto" resizes and crops with automatic focal point detection:

@Html.IntelligenceBankMediaItem(Model, "ibImagePicker", transform: "size=400&crop=200x200&cropgravity=auto")

Renders as:

young fitness woman runner running at sunrise seaside

Transformations for Rich Text and Block Grid

To use transformations on RTE or Block Grid content, call the .Transform() method. Include the following namespace:

@using IntelligenceBank.Umbraco.Connector.Core.Models;

Note: The transformation will be applied to all IntelligenceBank assets within the content.

Rich Text Editor (all versions)

@Model.Value("rteField").Transform("size=300")

Grid Component (v11-13)

@Html.GetGridHtml(Model, "gridComponent").Transform("size=200")

Block Grid (v14+)

@{
    var blockGrid = Model.Value<BlockGridModel>("blockGridAlias");
}
@await Html.GetBlockGridHtmlAsync(blockGrid)

For Block Grid, apply transformations within individual block partial views using @Html.IntelligenceBankMediaItem() with the transform parameter.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article