Copied to clipboard

Flag this post as spam?

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


  • Tim Melis 22 posts 43 karma points
    Apr 11, 2011 @ 19:12
    Tim Melis
    0

    Path to cropped image ?

     

    Hi,

    I've created a summary page of all subpages. Everything works fine. Even the images are in place. However, when doing some tests, I noticed that my cropped images aren't used on the page, but the original ones. How do I get the path to the cropped image ? Below the syntax I'm currently using...

     

    <xsl:variable name="mediaId" select="number(thumbnail)" />

    <xsl:if test="$mediaId > 0">

    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />

     <xsl:if test="$mediaNode/umbracoFile">

     <img src="{$mediaNode/umbracoFile}" alt="[image]" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" border="2" class="overKAL_thumb"/>

    </xsl:if>

    </xsl:if>

     

     

    Any help would be greatfull..

    Kind regards

    Tim

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 11, 2011 @ 19:55
    Tom Fulton
    0

    Hi Tim,

    You can get the crop path using $mediaNode/yourCropAlias/crops/crop [@name='yourcropname]/@url

    Something like:

    <img src="{$mediaNode/umbracoFile}" alt="[image]" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" border="2" class="overKAL_thumb">
    <xsl:if test="count($mediaNode/yourCropAlias/crops/crop [@name='yourcropname']) &gt; 0">

    <!-- override the src attribute with the cropped URL if one exists -->
    <xsl:attribute name="src">
          <xsl:value-of select="$mediaNode/yourCropAlias/crops/crop [@name='yourcropname']/@url" />
    </xsl:attribute>
    </xsl:if>
    </img>

    Hope this helps,
    Tom

  • Tim Melis 22 posts 43 karma points
    Apr 13, 2011 @ 16:40
    Tim Melis
    0

    Hi Tom,

    Thanx for the information. I' didn't work in my case but thanx to you I found a solution... Below the code

            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
              <xsl:if test="$mediaNode//crop [@name = $myCropName]/@url">
                  <img src="{$mediaNode//crop [@name = $myCropName]/@url}" alt="Image" />
             </xsl:if>

    Thanx for your help.

    Kind regards

    Tim

     

     

  • 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