Copied to clipboard

Flag this post as spam?

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


  • Jan 54 posts 74 karma points
    Sep 12, 2011 @ 14:08
    Jan
    0

    old method to pull out a IMG doesent work in new umbraco?

    hey all.

    i used umbraco a while back but just recently decided to try this new version.

    but now pictures wont show that i have pulled from my media folder as such.

    <umbraco:Item runat="server" field="mediapicker1" xslt="concat('&lt;img class=&quot;sidelogo&quot; src=&quot;', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '&quot;alt=&quot;', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '&quot;/&gt;')" xsltDisableEscaping="true" />

    has something changed or am i doing it wrong / or is there a easier way now with new version ?

    thanx.
      

  • Euan Rae 105 posts 135 karma points
    Sep 12, 2011 @ 15:02
    Euan Rae
    0

    there is a new xml schema, so to get the image instead of

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

    all you need to do is

    umbraco.library:GetMedia(mediaId, 'true')/umbracoFile

  • Jan 54 posts 74 karma points
    Sep 13, 2011 @ 14:12
    Jan
    0

    hmm having problems getting it to work..  not sure whats wrong .

    field="mediapicker1"
    xslt="concat('&lt;img class=&quot;sidelogo&quot;
    src=&quot;', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '&quot;
    alt=&quot;', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '&quot;/&gt;')" xsltDisableEscaping="true" />

    what is wrong with this line ?
        

  • Euan Rae 105 posts 135 karma points
    Sep 13, 2011 @ 15:21
    Euan Rae
    0

    sorry, I was just using 'media' id as an example.

    In your instance change

    umbraco.library:GetMedia(mediaId, 'true')/umbracoFile

    to 

    umbraco.library:GetMedia({0}, 'true')/umbracoFile

     

  • Jan 54 posts 74 karma points
    Sep 14, 2011 @ 10:45
    Jan
    0

    wow .. hehe i just cant get it working.    what is the preferred way to make a mediapicker picture on a page ?  

    cause ive tried this now and still no luck.

    <umbraco:Item
    runat="server"
    field="excommikon"
    xslt="concat('&lt;img
    class=&quot;sidelogo&quot;
    src=&quot;', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '&quot;
    alt=&quot;', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '&quot;/&gt;')" xsltDisableEscaping="true" />

  • Euan Rae 105 posts 135 karma points
    Sep 14, 2011 @ 10:51
    Euan Rae
    0

    What's the actual output you are getting?

    Have you tried doing up a quick xslt macro, passing in the media id and just using

    umbraco.library:GetMedia(mediaId, 'true')/umbracoFile

    to see if it gets the file out correctly?

    Also, I don't think the second parameter needs to be true, you should be able to get it to work with false

  • Jan 54 posts 74 karma points
    Sep 14, 2011 @ 11:39
    Jan
    0

    am not getting any output at all - just a empty line.

    no . i havent tried that . but i properly wouldent know how to :( im awfully new at this.


  • Jan 54 posts 74 karma points
    Sep 14, 2011 @ 11:56
    Jan
    0

    ok i just did a

    <xsl:variablename="media"select="umbraco.library:GetMedia($currentPage/imageAlias, 0)"/>

    <xsl:iftest="$media">
           
    <imgsrc="{$media/umbracoFile}"alt="{$media/altText}"/>
    </xsl:if>


    macro - worked fine....weird...   this is alot easier heh....

  • Euan Rae 105 posts 135 karma points
    Sep 14, 2011 @ 12:00
    Euan Rae
    0

    Yep, macros are a lot easier to read/write; you don't need to worry about chaning '<' into '&lt;'.  Plus it's better practice as it allows you to seperate functionality out from your template.

  • Jan 54 posts 74 karma points
    Sep 14, 2011 @ 12:24
    Jan
    0

    thanx for the help ;)

  • 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