I am completely stuck on how to render an image from the media uploader, using Embedded Content, to show on the actual page!? All that is showing is the media ID. My XSL is below.
I have searched and see that this may be something to do with not having created a macro but really I am completely lost in using this with Embedded Content.
"icon" is the image and everything else works and shows fine?
Any help and solutions would really be appreciated.
Thank you so much for your help so far. Unfortunately it seem I understand this less than I thought as I don't know where to place this image tag? I'm assuming I'm right in trying to put it in the xsl file but I don't know where? I have ttroed both Dirk and Sam's and neither seem to have worked? When I have placed them in places where I can save without errors it just stops rendering anything from this file (Firebug says "Error parsing XSLT file: \xslt\StaffMembers.xslt").
Seriously, thank you all for your help and advice so far. Anymore tips and advice to get this to work would be great? Like possibly where to place this img tag or other ideas?
You said earlier that 'icon' is the image. Is that the alias of the media picker or the name of your actual image ie icon.png? The error could be caused by not choosing an image in the content section before running the macro.
In the doctype that is used for whatever page you're on, there should be a media picker with an alias of 'icon'. Make sure that has an image associated with it.
Could you post your entire xslt file here so we can see possible other causes of error?
Also, what is the structure of your site? Maybe $currentPage is wrong. Could try:
Render Image from Media Picker
HI there,
I am completely stuck on how to render an image from the media uploader, using Embedded Content, to show on the actual page!? All that is showing is the media ID. My XSL is below.
I have searched and see that this may be something to do with not having created a macro but really I am completely lost in using this with Embedded Content.
"icon" is the image and everything else works and shows fine?
Any help and solutions would really be appreciated.
Thank you
Andy
What helps me a lot is if I do the following in the xslt:
<textarea><xsl:copy-of select="." /></textarea>
or
<textarea><xsl:copy-of select="icon" /></textarea>
or
<textarea><xsl:copy-of select="icon" /></textarea>
This allows you to see the exact structure of the xml you are dealing with in a textbox.
Hope this helps.
Hi Brendan,
Thanks for this tip! Will be useful in future too. Now where my image should be is
Not sure yet what to do with this info?
Any solutions would be welcome?
Thanks
Andy
Hi Brendan,
here is a xslt snippet to build an img tag from the media id:
Dirk
Hi Andy,
You could also try this:
Sam.
As Dirk and Sam pointed out you only get the ID of the media item, you then have to do a seperate lookup to get that media items xml data.
Hi guys,
Thank you so much for your help so far. Unfortunately it seem I understand this less than I thought as I don't know where to place this image tag? I'm assuming I'm right in trying to put it in the xsl file but I don't know where? I have ttroed both Dirk and Sam's and neither seem to have worked? When I have placed them in places where I can save without errors it just stops rendering anything from this file (Firebug says "Error parsing XSLT file: \xslt\StaffMembers.xslt").
Seriously, thank you all for your help and advice so far. Anymore tips and advice to get this to work would be great? Like possibly where to place this img tag or other ideas?
Thank you
Andy
Hi Andrew,
one possible place, based on your fragment, could be here (replacing the icon id value):
Dirk
Thanks for your quick response Dirk!
Still producing the same error "Error parsing XSLT file: \xslt\StaffMembers.xslt"!? Is it something to do with using the Embedded Content package?
I didn't think it would be this hard to produce an image from the media file!
Thanks again
Andy
Hi Andy,
You said earlier that 'icon' is the image. Is that the alias of the media picker or the name of your actual image ie icon.png? The error could be caused by not choosing an image in the content section before running the macro.
In the doctype that is used for whatever page you're on, there should be a media picker with an alias of 'icon'. Make sure that has an image associated with it.
Could you post your entire xslt file here so we can see possible other causes of error?
Also, what is the structure of your site? Maybe $currentPage is wrong. Could try:
Basically, where are the pages located that use the media picker in relation to the actual page on your site that the image is displayed?
If that makes any sense? :)
Sam.
Thanks Sam!
It was simply that $currentPage was wrong! Fell a bit stupid when it is something like that! Not used to Umbraco enough yet to have seen it!
Thank you again and to Brendan and Sam too!
Andy
Hi Andy,
Glad you got it sorted :)
Sam.
is working on a reply...