Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan Zhang 3 posts 73 karma points
    Sep 16, 2015 @ 07:27
    Nathan Zhang
    0

    Get Media Image in XSLT Loop

    Trying to get media picker field from loop item

    Tried umbraco.library:GetMedia(featuredimage, 0)
    umbraco.library:GetMedia(./featuredimage, 0)
    umbraco.library:GetMedia(current()/featuredimage, 0)

    in xsl:for-each loop, all failed, but I can pull text field data like heading ...

    Does anyone know what is the right way please.

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Sep 16, 2015 @ 10:51
    Alex Skrypnyk
    1

    Hi Nathan,

    Did you try ?

    umbraco.library:GetMedia($currentPage/propertyAlias, 0)/umbracoFile
    

    Example how to render image:

     <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/bannerImage, 0)" />
    
     <xsl:if test="$media">
        <xsl:variable name="url" select="$media/umbracoFile" />
        <xsl:variable name="width" select="$media/umbracoWidth" />
        <xsl:variable name="height" select="$media/umbracoHeight" />
        <img src="{$url}" width="{$width}" height="{$height}" />
     </xsl:if>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies