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
DOCMEDIA
{{DOCMEDIA mediaList ="97" class="testClass"}}
Will render anchor tags for each media item.
Parameters
All are optional, although not providing a
Name | Type | Description |
---|---|---|
mediaList | String | A comma separated list of media IDs, eg |
subType | String | The media component to output. If omitted the first component returned will be rendered (order is not guaranteed) |
class | String | A CSS class that will be appended to the existing class attribute of each figure or anchor as it is output |
title | String | If omitted the media description is used |
text | String | If omitted the media title is used. An empty string can also be set |
constraint | String | Default 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.