Copied to clipboard

Flag this post as spam?

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


  • Setii 1 post 71 karma points
    May 04, 2016 @ 10:19
    Setii
    0

    Hello Everyone,

    For some time now i've been reusing the same xslt script to get the url from a media picker property. This is the code i'm using:

    <xsl:variable name="mediaId" select="number(rowPicture)" />
    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
    <img src="{$mediaNode/umbracoFile}" />
    

    This used to work, but now in 7.4.3, i'm getting this value:

    <img src="{src: '/media/1002/test.jpg', crops: []}" />
    

    Did this recently change, and is there another way/property for getting a media picker url ?

    thanks, Pedro

  • Laith 6 posts 46 karma points
    May 25, 2016 @ 16:11
    Laith
    0

    Hi Setii,

    I came across your question whilst also looking to solve this problem.

    I solved it by using the following code:

    var mediaNode = new UmbracoHelper(UmbracoContext.Current).TypedMedia(mediaId);
    return mediaNode.Url;
    

    You should be able to use this and apply to your xslt!

    Also this link may help: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/image-cropper

    Hope this helps,

    Laith

Please Sign in or register to post replies

Write your reply to:

Draft