imageUrlΒΆ

This generates a URL pointing to an image.

Parameters:

_id
Id to the image.
_path
Path to the image. If _id is specified, this parameter is not used.
_format
Format of the image.
_scale
Resize and crop the image to fit the available area. See: Scaling
_quality
Quality for JPEG images, ranges from 0 (max compression) to 100 (min compression). Default is 85.
_background
Background color.
_filter
Styling filters to use on the image. More than one filter may be combined with a semicolon. See: Styling
_type
URL type. Either server (server-relative URL) or absolute. Default is server.
everything else
Custom parameters to append to the url.

Usage in Thymeleaf:

<img data-th-src="${portal.imageUrl({'_id=11', '_scale=width(200)'})}"/>
<img data-th-src="${portal.imageUrl({'_path=test', '_scale=width(200)'})}"/>

Usage in XSLT:

<xsl:stylesheet version="2.0" exclude-result-prefixes="#all"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:portal="urn:enonic:xp:portal:1.0">

  <xsl:template match="/">
    <xsl:value-of select="portal:imageUrl('_id=11', 'scale=width(200)')"/>
    <xsl:value-of select="portal:imageUrl('_path=test', 'scale=width(200)')"/>
  </xsl:template>

</xsl:stylesheet>