Copied to clipboard

Flag this post as spam?

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


  • Bent Holz 100 posts 273 karma points
    Oct 20, 2011 @ 10:12
    Bent Holz
    0

    Display Cropped image from Media Picker

    Hi there 

    Been searching and found alot on the subject, but alas, no solution in my case...

    I have set up a crop-function and what i need to do, is simply display a cropped image selected via the media picker on a page.

    I can get it to display the id of the picture, and from looking in the forum I even got the image displayed... But I need the cropped version.

    So I assume I need to make an Xslt Macro?!

    From an earlier project the following Xslt displays a list of images:

    <xsl:template match="/">
    <ul>  
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
            <xsl:if test="forsidebillede != ''">
                <xsl:variable name="myPic" select="umbraco.library:GetMedia(forsidebillede,'false')/umbracoFile" />
                <img src="{concat(substring-before($myPic,'.'),'_FrontSlide.',substring-after($myPic,'.'))}" border="0" alt="{@nodeName}" />
            </xsl:if>
      </li>
    </xsl:for-each>
    </ul>  
    </xsl:template> 

    forsidebillede = alias property
    FrontSlide = crop

    I tried "modding" this to just show one picture but without any luck...

    Any ideas out there?

     

  • Bent Holz 100 posts 273 karma points
    Oct 21, 2011 @ 11:04
    Bent Holz
    0

    Yeee... i solved it myself :)

    <xsl:template match="/">

        <xsl:variable name="mediaId" select="number($currentPage/billede)" />
        <xsl:if test="$mediaId > 0">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
            <xsl:if test="$mediaNode/umbracoFile">
              <img src="{concat(substring-before($mediaNode/umbracoFile,'.'),'_FrontSlide.',substring-after($mediaNode/umbracoFile,'.'))}" border="0" alt="{@nodeName}" />
            </xsl:if>
        </xsl:if>  

    </xsl:template>

  • Michael 63 posts 211 karma points
    Apr 23, 2013 @ 09:57
    Michael
    0

    Thx for posting your solution, it came in handy :D

Please Sign in or register to post replies

Write your reply to:

Draft