Copied to clipboard

Flag this post as spam?

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


  • Ashok Raja 12 posts 32 karma points
    Oct 13, 2010 @ 10:33
    Ashok Raja
    0

    umbraco.library:GetMedia() in 4.5.2 not returning value

    Have changed the xslt schema (4.0.3) from

     

    <xsl:attribute name="src">

    <xsl:value-of select="umbraco.library:GetMedia(data[@alias = 'navigationImage'], 'false')/data"/>

    </xsl:attribute> 

     

    to 4.5.2

    <xsl:attribute name="src">

    <xsl:value-of select="umbraco.library:GetMedia(navigationImage, 'false')/data"/>

    </xsl:attribute>

     

    but the url data is not fetched.

     

    Details from umbraco.config file 

     

          <node id="5934" version="d455c71b-f274-4aee-beeb-a7f698be9593" parentID="5933" level="3" writerID="0" creatorID="12" nodeType="1872" template="0" sortOrder="1" createDate="2009-11-16T10:11:12" updateDate="2010-07-12T15:28:24" nodeName="netflights-logo" urlName="netflights-logo" writerName="Administrator" creatorName="Test Test" nodeTypeAlias="NavigationItem" path="-1,1873,5933,5934">

            <data alias="pageId">1261</data>

            <data alias="seoFooterHtml"><![CDATA[]]></data>

            <data alias="url">

            </data>

            <data alias="openInNewWindow">0</data>

            <data alias="ExcludeSitemap">0</data>

            <data alias="navigationImage">5932</data>

            <data alias="navigationImageAltText">Testing</data>

          </node>

     

    Browser output:

    <img title="Testing" alt="Testing" src="" id="logo">

     

    Please advice.

  • Magnus Eriksson 122 posts 362 karma points
    Oct 13, 2010 @ 10:44
    Magnus Eriksson
    0

    The XML in your umbraco.config seems to be the old schema. What happens if you select data[@alias = 'navigationImage'] instead?

    Regards,
    Magnus

  • Ashok Raja 12 posts 32 karma points
    Oct 13, 2010 @ 10:59
    Ashok Raja
    0

    Thanks Magnus. You're right, the umbraco.config was the old schema for some reason. I deleted & re-generated it. Now it's looking like this

          <NavigationItem id="5934" parentID="5933" level="3" writerID="0" creatorID="12" nodeType="1872" template="0" sortOrder="1" createDate="2009-11-16T10:11:12" updateDate="2010-10-12T15:03:32" nodeName="netflights-logo" urlName="netflights-logo" writerName="Administrator" creatorName="Test Test" path="-1,1873,5933,5934" isDoc="">

            <pageId>1261</pageId>

            <seoFooterHtml><![CDATA[]]></seoFooterHtml>

            <url>

            </url>

            <openInNewWindow>0</openInNewWindow>

            <ExcludeSitemap>0</ExcludeSitemap>

            <navigationImage>5932</navigationImage>

            <navigationImageAltText>Testing</navigationImageAltText>

          </NavigationItem>

    but makes no difference.

    I also tried

       <xsl:value-of select="umbraco.library:GetMedia(data[@alias = 'navigationImage'], 'false')/data"/>
     <xsl:value-of select="umbraco.library:GetMedia(navigationImage, 'false')/data[@alias = 'navigationImage']"/>
       <xsl:value-of select="umbraco.library:GetMedia(navigationImage, 'false')/umbracoFile"/>              
  • Tom Hare 49 posts 81 karma points
    Oct 13, 2010 @ 18:44
    Tom Hare
    0

    What happens if you replace 'false' with just 0 (no quotes) in your GetMedia call?

  • Ashok Raja 12 posts 32 karma points
    Oct 14, 2010 @ 10:12
    Ashok Raja
    0

    Tom - makes no difference.

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 14, 2010 @ 10:43
    Dirk De Grave
    0

    Ran into the same issue, here's what I did:

    - save the image again, and it'll show up.

    It'll work, but using this method, you'd be saving all images one by one, which is not an option for large media section. But, umbraco to the rescue. If you're using the new xml schema, browse to http://mysite/umbraco/dialogs/republish.aspx?xml=true (See this reference on the wiki)

     

    Cheers,

    /Dirk

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 14, 2010 @ 10:45
    Dirk De Grave
    0

    Oh, once that's done, your third statement

    <xsl:value-of select="umbraco.library:GetMedia(navigationImage, 'false')/umbracoFile"/> 

    will work.

    And on the performance side of things, output of GetMedia() call will be cached, so faster response times and no more db access for any subsequent call for the same image.

    /Dirk

  • Ashok Raja 12 posts 32 karma points
    Oct 14, 2010 @ 11:01
    Ashok Raja
    0

    Dirk - you're a star. :) Many thanks mate. Indeed saving the image worked.

    I was scratching my head for 3 days on this.

  • 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