imgfn templating functions provide useful functions for handling image resources stored in any workspace. They are commonly used to resolve image variations.

imgfn templating functions are provided by the Imaging module.

Magnolia recommends you store images in the DAM workspace and use damfn templating functions instead to benefit from the DAM API (see How to work with images using damfn).

Retrieves a link to an image variation from binary content.

Method signature

String getImageVariationLinkFromBinary(``ContentMapbinaryContent, String variation)


String getImageVariationLinkFromBinary(``NodebinaryContent, String variation)


Argument Description



Either the ContentMap or the Node of the binary you want to render.



An image variation defined in the site theme.

original if you want the original size of the image.



A link to an image variation.


imgfn.getImageVariationLinkFromBinary(binaryContent, variation)

[#assign binaryNode = cmsfn.asJCRNode(content).getNode('binaryNodeName')]
[#assign imgLink = imgfn.getImageVariationLinkFromBinary(binaryNode,'original')]
[#assign imgLink240 = imgfn.getImageVariationLinkFromBinary(binaryNode,'240')]

The example above assumes that you have defined an image variation named 240 in your theme.

binaryNodeName is the default name of the subnode that contains the file binary and related information. Use cmsfn to transform this node into a JCR node that can be used in templating function arguments.

Related topics

DX Core



This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules
6.3 beta

Magnolia 6.3 beta

Magnolia 6.3 is in beta. We are updating docs based on development and feedback. Consider the 6.3 docs currently in a state of progress and not final.

We are working on some 6.3-beta known issues during this phase.