stk:image.create-url(template)

This template creates an optimized image URL for an image content in Enonic CMS. Based on portal:createImageUrl in Enonic CMS, with a key performance benefit in doing the image scaling based on closest prescaled version, rather than the original image.

xs:stringstk:image.create-url
  1. element()image
  2. xs:string?scaling
  3. xs:string?size
  4. xs:string?filter
  5. xs:string?format
  6. xs:integer?quality
  7. xs:integeravailable-width
  8. xs:string?background

Examples

Input

<xsl:if test="$relatedcontents/content[@key = $image-key]">
    <xsl:call-template name="stk:image.create-url">
        <xsl:with-param name="image" select="$relatedcontents/content[@key = $image-key]"/>
    </xsl:call-template>
</xsl:if>

Result

https://enonic.com/stk/template-reference/xslt/image/_image/89.jpeg?_encoded=2f66666666666678302f30382f3b2934286465646e756f723b2930353331286874646977656c616373&_ts=1413ab5ab22

Parameters

image
Type
element()
scaling
Type
xs:string?
size
Type
xs:string?
filter
Type
xs:string?
Default
$stk:config-filter
format
Type
xs:string?
Default
$stk:default-image-format
quality
Type
xs:integer?
Default
$stk:default-image-quality
available-width
Note: changed from "scale-width"
Type
xs:integer
background
Type
xs:string?