Copied to clipboard

Flag this post as spam?

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


  • Rasmus Lynggaard 118 posts 325 karma points
    May 06, 2010 @ 15:30
    Rasmus Lynggaard
    0

    umbraco.library:GetMedia in v4.1?

    using umbraco.library:GetMedia in xslt in umbraco 4.1 doesn't return anything.

    Can anybody help out what to use/do?

    /Rasmus

  • bob baty-barr 1180 posts 1294 karma points MVP
    May 06, 2010 @ 23:29
    bob baty-barr
    0

    i had the same issue when the beta first came out... and really... got no response from anyone... and no solution either.

     

    sorry

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 07, 2010 @ 00:43
    Aaron Powell
    0

    If it seems like a bug then it should be logged on Codeplex

  • David Conlisk 432 posts 1008 karma points
    May 18, 2010 @ 17:27
    David Conlisk
    0

    Has this been logged on codeplex? A search in the issue tracker for getmedia returns nothing...

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 18, 2010 @ 18:08
    Douglas Robar
    0

    Good heavens, if it isn't there... go add it!

    cheers,
    doug.

  • David Conlisk 432 posts 1008 karma points
    May 19, 2010 @ 15:09
    David Conlisk
    0

    Yes sir! :) I've confirmed this is a bug for me in v4.1 beta 2. Go vote!

    http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=27109

  • dandrayne 1138 posts 2262 karma points
    Jun 10, 2010 @ 17:28
    dandrayne
    0

    Crap, this is stopping me updating a few packages to 4.1.

    voted on codeplex

  • David Conlisk 432 posts 1008 karma points
    Jun 10, 2010 @ 17:34
    David Conlisk
    0

    It's been fixed in the nightlies for a while, I think, just waiting for the RC...

  • David Conlisk 432 posts 1008 karma points
    Jun 15, 2010 @ 16:14
    David Conlisk
    0

    It seems that is still doesn't work in 4.1RC. Calling this:

    <xsl:variable name="videoNode" select="umbraco.library:GetMedia(1341, '1')"/>
    node:<xsl:value-of select="$videoNode"/><br/>

    results in this output:

    
    node:No media is maching '1341'

    1341 is the id of a flash file that definitely exists and can be browsed through the Media section. Anyone else getting this?

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Jun 15, 2010 @ 16:21
    Tom Madden
    1

    I get this if I point it to an image file:
    node:/media/244/colour change.jpg1074976586198jpg
    so I gues using the proper umbracoFile syntax will work.

  • David Conlisk 432 posts 1008 karma points
    Jun 15, 2010 @ 16:32
    David Conlisk
    0

    Hmm, I dunno. Check this out, I'm trying to output an image - the id is stored as the image attribute of my eventNode:

    imageid:<xsl:value-of select="$eventNode/image"/><br/>
    image:<xsl:copy-of select="umbraco.library:GetMedia($eventNode/image, '0')"/><br/>

    Gives output of:

    imageid:1102<br>
    image:<Image id="1102" version="919be0a6-f6a0-4a41-ac89-c29678b11622" parentID="-1" level="1" writerID="0" nodeType="1032" template="0" sortOrder="2" cateDate="2010-05-17T15:25:18" updateDate="2010-05-17T15:25:18" nodeName="World Map Image" urlName="worldmapimage" writerName="Administrator" nodeTypeAlias="Image" path="-1,1102"><umbracoFile></umbracoFile><umbracoWidth></umbracoWidth><umbracoHeight></umbracoHeight><umbracoBytes></umbracoBytes><umbracoExtension></umbracoExtension></Image><br>

    How can I now display the image if umbracoFile is empty?

     

     

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Jun 15, 2010 @ 16:37
    Tom Madden
    1

    This works for me in 4.1RC when hard coding the property names mainImage and altText:

    <xsl:variable name="picFile" select="$currentPage/mainImage"/>
    <xsl:variable name="altText" select="$currentPage/altText"/>

    <xsl:if test="$picFile != ''">
      <img id="mainImage" src="{umbraco.library:GetMedia($picFile, 'false')/umbracoFile}" >
          <xsl:attribute name="alt">
              <xsl:value-of select="$altText"/>
          </xsl:attribute>
          <xsl:attribute name="width">
              <xsl:value-of select="umbraco.library:GetMedia($picFile, 'false')/umbracoWidth" />
          </xsl:attribute>
          <xsl:attribute name="height">
              <xsl:value-of select="umbraco.library:GetMedia($picFile, 'false')/umbracoHeight" />
          </xsl:attribute>
      </img>
    </xsl:if>

     

    However I can't replace the $currentPage/mainImage with $currentPage/$picFile since the $ causes an error, will investigate further

    HTH

  • David Conlisk 432 posts 1008 karma points
    Jun 15, 2010 @ 16:53
    David Conlisk
    0

    Hi @quixltd,

    Okay so it turns out I'm being an idiot and in my second example I'm trying to output a media item that on further inspection doesn't actually have a file uploaded for it in the Media section! Doh. So images do seem to work -when an image has been actually uploaded :)

    Right and the second problem was fixed by going in to my media types where I had created a new type called Flash Movie. I saved this, then saved my video in the Media section, et viola - it works.

    Thanks @quixltd for taking the time to have a look. Thankfully it seems to be working fine, and maybe this discussion will help others with the same issues I had!

    Cheers,

    David

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Jun 25, 2010 @ 01:01
    Tom Madden
    1

    An update for Umbraco 4.5!!!!!

    While the code I posted earlier works for 4.1RC it doesn't for for 4.5, with thnks to Lee Kelleher, the updated version which works in 4.5 is:

    <xsl:variable name="picFile" select="$currentPage/mainImage"/>
    <xsl:variable name="altText" select="$currentPage/altText"/>

    <xsl:if test="$picFile != ''">
      <img id="mainImage" src="{umbraco.library:GetMedia($picFile, 'false')/Image/umbracoFile}" >
          <xsl:attribute name="alt">
              <xsl:value-of select="$altText"/>
          </xsl:attribute>
          <xsl:attribute name="width">
              <xsl:value-of select="umbraco.library:GetMedia($picFile, 'false')/Image/umbracoWidth" />
          </xsl:attribute>
          <xsl:attribute name="height">
              <xsl:value-of select="umbraco.library:GetMedia($picFile, 'false')/Image/umbracoHeight" />
          </xsl:attribute>
      </img>
    </xsl:if>

    The only difference is the addition of /Image in front of /umbracoFile to become /Image/umbracoFile

    This also works with the other syntax of:

    img src="{umbraco.library:GetMedia($picFile, 'false')/Image/umbracoFile}" width=etc.

    Hope this helps spme people

    Tom


  • bob baty-barr 1180 posts 1294 karma points MVP
    Jun 25, 2010 @ 01:37
    bob baty-barr
    0

    yes, i learned earlier today that the /Image is very important :)

Please Sign in or register to post replies

Write your reply to:

Draft