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:
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:
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?
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('<img src="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '" />')"
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
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="<img src="" insertTextAfter="" />" runat="server"></umbraco:Item>
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?
Use this:
<umbraco:Item field="TopLeftImage" insertTextBefore="<img src="" xslt="umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile']" insertTextAfter="" />" runat="server"></umbraco:Item>
You can also see an example here: http://umbraco.org/documentation/books/inline-xslt
The correct link is http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt
is working on a reply...