Copied to clipboard

Flag this post as spam?

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


  • Jim Lesinski 32 posts 54 karma points
    Dec 22, 2009 @ 21:35
    Jim Lesinski
    0

    Umbraco Template/ Render Image from Upload or Media

    Hello, I am new to Umbraco. I created a master page and I am trying to create a placeholder for an image. It added an upload Property to my document type, and uploaded an image, but I cannot seem to get the image to display in the template. Inserting the tag:

    <umbraco:Item field="TopLeftImage" runat="server" ></umbraco:Item>

    will display the path to the image, but does not display the actual image. I also tried:

    <img src=  <?UMBRACO_GETITEM field="TopLeftImage"/>   />

    and I have tried:

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

     

    None of these seems to work for me. If someone can point me to a tutorial that works or tell me what I am doing wrong I would appreciate it.

    umbraco v 4.0.3 (Assembly version: 1.0.3625.27276)

     

    Thanks,

    Jim

  • Jim Lesinski 32 posts 54 karma points
    Dec 22, 2009 @ 21:47
    Jim Lesinski
    0

    AHA - I figured it out. I knew it had to be something I was missing! I used the "Insert before field" and "Insert after field" fields when adding the field and it generated this:

    <umbraco:Item field="TopLeftImage" useIfEmpty="TopLeftImage" insertTextBefore="&lt;img src=&quot;" insertTextAfter="&quot; /&gt;" runat="server"></umbraco:Item>

  • Amir Khan 1282 posts 2739 karma points
    Mar 31, 2010 @ 06:16
    Amir Khan
    0

    So I'm trying to achieve the same thing as you, when I use the code you posted, it generates the tag properly, but just inserts a number where the image is, no file path. Any ideas?

  • Ove Andersen 435 posts 1541 karma points c-trib
    Apr 13, 2010 @ 10:18
    Ove Andersen
    0

    Use this:

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

  • Ove Andersen 435 posts 1541 karma points c-trib
    Apr 13, 2010 @ 10:21
    Ove Andersen
    1

    You can also see an example here: http://umbraco.org/documentation/books/inline-xslt

  • Mladen B. 12 posts 35 karma points
    Sep 30, 2014 @ 12:55
Please Sign in or register to post replies

Write your reply to:

Draft