Copied to clipboard

Flag this post as spam?

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


  • Mark 1 post 21 karma points
    Dec 28, 2010 @ 00:11
    Mark
    0

    media in template...HELP

    I have a doc variable called 'rightSideImage' that is a Media Picker type.  When I insert this in a document template (not xslt), it used the media id (eg, 1096) instead of the URL.  How do I insert this in a document template?  I know how to do it in XSLT but not the template.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 28, 2010 @ 00:19
    Kim Andersen
    1

    Hi Mark

    I'm pretty sure you need to use some inline xslt in the template, but you should be able to render your image like this:

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

    The above code is intended for the new XML schema. But this should render a img-tag with the right path to the image.

    /Kim A

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 28, 2010 @ 00:57
    Tom Fulton
    0

    You might be aware of this, but typically I make a generic XSLT macro called something like InsertImage that can be inserted into the template to render images.  You can pass the value of rightSideImage using the macro parameter syntax, ie: <umbraco:Macro alias="InsertImage" imageId="[#rightSideImage]">.  It will work either way, personally I think this is a bit cleaner though.

Please Sign in or register to post replies

Write your reply to:

Draft