Copied to clipboard

Flag this post as spam?

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


  • Istvan Pszota 59 posts 191 karma points
    Mar 05, 2016 @ 14:00
    Istvan Pszota
    0

    XSLT GetMedia/umbracoFile returns new schema??

    Hello!

    Just started to develop a new website with the latest build (Umbraco version 7.4.1 assembly: 1.0.5891.23238), and found that

    umbraco.library:GetMedia()/umbracoFile
    

    returns a new schema, and i can not get rid of it.

    <img src="{umbraco.library:GetMedia(./image, 0)/umbracoFile} />
    

    returns this:

    <img src="{src: '/media/1001/1-nothumbnail.jpg', crops: []}>
    

    I just want the URL of the image, nothing else.. Anyone experienced the same?

    Thanks, Istvan

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 05, 2016 @ 14:34
    Chriztian Steinmeier
    100

    Hi Istvan,

    Yes, that's the new Umbraco 7 way - many property editors are storing their data as JSON these days...

    If you just want the URL and doesn't want to handle the croppings, you can use another helper method to turn the JSON chunk into XML:

    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(image, false())" />
    <xsl:variable name="data" select="umbraco.library:JsonToXml($mediaNode/umbracoFile)" />
    <img src="{$data/src}" />
    

    Hope that helps,

    /Chriztian

  • Istvan Pszota 59 posts 191 karma points
    Mar 05, 2016 @ 14:36
    Istvan Pszota
    0

    Hi Chriztian!

    Thanks, your solution works, as always! :)

    Wondering how i could not realize that the return format is JSON..

    Thanks, Istvan

Please Sign in or register to post replies

Write your reply to:

Draft