Toggle menu

Media Item Helpers

The media helpers can display media items from the iCM media library. Usual media security applies, so site users will have to be logged in (and in the appropriate groups) to see secure items.

IMAGEMEDIA

{{IMAGEMEDIA mediaList ="82, 943" class="testClass" constraint="variant1"}}

Will render figure tags for each media item even if the file is not an image. Where an image has multiple components, the first that is returned will be output if the subType parameter is not set.

DOCMEDIA

{{DOCMEDIA mediaList ="97" class="testClass"}}

Will render anchor tags for each media item.

Parameters

All are optional, although not providing a mediaList will output nothing.

NameTypeDescription
mediaListStringA comma separated list of media IDs, eg {{IMAGEMEDIA mediaList="1,2,3"}}
subTypeStringThe media component to output. If omitted the first component returned will be rendered (order is not guaranteed)
classStringA CSS class that will be appended to the existing class attribute of each figure or anchor as it is output
titleStringIf omitted the media description is used
textStringIf omitted the media title is used. An empty string can also be set
constraintStringDefault is "standard", "original" is also useful. Used by IMAGEMEDIA to generate the image URL (and resulting size) when rendered in the framework

Templates

Figure

<figure class="icmformdataimage{{class}}">
    <img src="{{url}}" alt="{{title}}" />
    <figcaption>{{text}}</figcaption>
</figure>

Anchor

<a href="{{url}}" target="_blank" title="{{title}}" class="icmformdatalink{{class}}">{{text}}</a>

Example

Handlebars Template

{{IMAGEMEDIA mediaList ="82" class="testClass" constraint="variant1"}}

Output

<figure class="icmformdataimage testClass">
    <img src="https://my-website.com/image/82/Red-square/variant1.png" alt="Red square">
    <figcaption>Red square</figcaption>
</figure>

Use in Emails and PDFs

When you are writing templates for emails and PDFs generated by the email action field, images and documents only ever appear as links to the files, it is not possible to embed media items directly into email or PDF content.

These helpers are not available to the emails or PDFs generated by the workflow mail activity.

Last modified on 14 February 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon