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 using Umbraco 4.0.2.1. And in my XSLT file I add following code
<img>
<xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia($imageId, 'true')" /> </xsl:attribute>
</img>
However when I see it from page source, it adds extra staff into the image URL like:
http://www.mydomain.com/media/21850/testImage.jpg24324416926jpg
Can anyone help me how to solve this problem?
Thank you
Hi,
Try changing the true value to false i.e. umbraco.library:GetMedia($imageId, 'false')
If that doesn't work can you post the complete XSLT
Cheers
Paul
Hi Jing,
The extra stuff you get is because GetMedia() returns an XML node - not just a string.
You should search the forum for "GetMedia" and "XSLT", as there are actually 1 or 2 answers given for this every week.
/Chriztian
Media nodes are slightly more confusing that normal nodes but this is what you actually need to do to get the source file path:
umbraco.library:GetMedia(@id, 'false')/data [@alias = 'umbracoFile']
The following post by Lee Kelleher on his blog should provide more detail on the subject:
http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/
Thanks Simon. I got it solved
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Problem with GetMedia
Hi All
I am using Umbraco 4.0.2.1. And in my XSLT file I add following code
<img>
<xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia($imageId, 'true')" /> </xsl:attribute>
</img>
However when I see it from page source, it adds extra staff into the image URL like:
http://www.mydomain.com/media/21850/testImage.jpg24324416926jpg
Can anyone help me how to solve this problem?
Thank you
Hi,
Try changing the true value to false i.e. umbraco.library:GetMedia($imageId, 'false')
If that doesn't work can you post the complete XSLT
Cheers
Paul
Hi Jing,
The extra stuff you get is because GetMedia() returns an XML node - not just a string.
You should search the forum for "GetMedia" and "XSLT", as there are actually 1 or 2 answers given for this every week.
/Chriztian
Media nodes are slightly more confusing that normal nodes but this is what you actually need to do to get the source file path:
The following post by Lee Kelleher on his blog should provide more detail on the subject:
http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/
Thanks Simon. I got it solved
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.