How To: Show a media library image using inline XSLT

You no longer need to use a macro to show an image in the HTML output that was chosen using a media picker. Umbraco's support for inline xslt from the Umbraco:Item tag has made this very easy to display.

Under the following conditions:

  • You have a document type with a property whose data type is Media Picker, and alias is 'mediaImage'
  • This property has been set to an image on your content node
  • You do not wish to display any markup if the image has not been set

Using the following tag in your template will display the image:

<umbraco:Item
    field="mediaImage"
    xslt="concat(
        '&lt;img src=&quot;',
        umbraco.library:GetMedia({0})/umbracoImage,
        '&quot; /&gt;'
    xsltDisableEscaping="true"/>