Copied to clipboard

Flag this post as spam?

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


  • Jing Ling 9 posts 29 karma points
    Dec 10, 2009 @ 07:30
    Jing Ling
    0

    Problem with GetMedia

    Hi All

    I am using Umbraco 4.0.2.1. And in my XSLT file I add following code

     <img>

        <xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia($imageId, 'true')" /> </xsl:attribute>

    </img>

     

    However when I see it from page source, it adds extra staff into the image URL like:

    http://www.mydomain.com/media/21850/testImage.jpg24324416926jpg

    Can anyone help me how to solve this problem?

    Thank you

  • Paul Blair 466 posts 731 karma points
    Dec 10, 2009 @ 08:49
    Paul Blair
    0

    Hi,

    Try changing the true value to false i.e. umbraco.library:GetMedia($imageId, 'false')

    If that doesn't work can you post the complete XSLT

    Cheers

    Paul

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 10, 2009 @ 09:09
    Chriztian Steinmeier
    0

    Hi Jing,

    The extra stuff you get is because GetMedia() returns an XML node - not just a string.

    You should search the forum for "GetMedia" and "XSLT", as there are actually 1 or 2 answers given for this every week.

    /Chriztian

  • Simon Dingley 1474 posts 3451 karma points c-trib
    Dec 10, 2009 @ 10:07
    Simon Dingley
    1

    Media nodes are slightly more confusing that normal nodes but this is what you actually need to do to get the source file path:

    umbraco.library:GetMedia(@id, 'false')/data [@alias = 'umbracoFile']

    The following post by Lee Kelleher on his blog should provide more detail on the subject:

    http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/

     

  • Jing Ling 9 posts 29 karma points
    Dec 10, 2009 @ 10:40
    Jing Ling
    0

    Thanks Simon. I got it solved

  • 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