Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I am trying to pull back images in a xsl loop from the media folder. My issue is that Umbraco generates random folder names.
How do I write the value of the image into my xsl document?
Heres what I have on page at the moment:
<img src="/media/{data [@alias = 'hostelImage']}.jpg" alt="" title="" />
This obviously pulls back:
<img src="/media/1277.jpg" alt="" title="" />
Any help would be great!
Thanks
Rog
Have a look at this -> http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/ but for a simple example see below
<img src="{umbraco.library:GetMedia(./data[@alias='hostelimage'], false())/data[@alias='umbracoFile']}" />
Dan
Thanks Dan,
The link doesnt work for me but the code works perfect.
Cool, but be aware that the code above will throw an error if for any reason the image is not picked. Best bet is something like
<xsl:if test="string(./data[@alias='hostelimage']) != ''"><img src="{umbraco.library:GetMedia(./data[@alias='hostelimage'], false())/data[@alias='umbracoFile']}" /></xsl:if>
p.s. If I had a penny for every time I wrote
<xsl:if test="string(./data[@alias='PROPERTY']) != ''">
I'd be on an island sipping pina coladas by now ^^
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Images from media into xslt
Hi all,
I am trying to pull back images in a xsl loop from the media folder. My issue is that Umbraco generates random folder names.
How do I write the value of the image into my xsl document?
Heres what I have on page at the moment:
<img src="/media/{data [@alias = 'hostelImage']}.jpg" alt="" title="" />
This obviously pulls back:
<img src="/media/1277.jpg" alt="" title="" />
Any help would be great!
Thanks
Rog
Have a look at this -> http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/ but for a simple example see below
Dan
Thanks Dan,
The link doesnt work for me but the code works perfect.
Thanks
Rog
Cool, but be aware that the code above will throw an error if for any reason the image is not picked. Best bet is something like
Dan
p.s. If I had a penny for every time I wrote
I'd be on an island sipping pina coladas by now ^^
is working on a reply...