Maybe try adding ?umbDebugShowTrace=true onto the end of your url. That way you should be able to get an idea of the error actually being thrown.
I think the issue is that $imageid won't have what you want in it. You'll want it to be a four digit ID of the image item. Could the issue be the name of the parameter you're passing in is different from what you expect? i.e you pass in umb_imageid="1091" but your expect /macro/imageid".
Why isn't my image showing?
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage" />
<xsl:variable name="imageid" select="/macro/imageid" />
<xsl:variable name="thumbwidth" select="/macro/thumbwidth" />
<xsl:variable name="align" select="/macro/align" />
<xsl:variable name="linktoorig" select="/macro/linktoorig" />
<xsl:variable name="uselightbox" select="/macro/uselightbox" />
<xsl:variable name="lightboxgroup" select="/macro/lightboxgroup" />
<xsl:template match="/">
<xsl:if test="$imageid != '' ">
imageid:<xsl:value-of select="$imageid" /><br/>
thumbwidth: <xsl:value-of select="$thumbwidth" /><br/>
align: <xsl:value-of select="$align" /><br/>
linktoorig: <xsl:value-of select="$linktoorig" /><br/>
uselightbox: <xsl:value-of select="$uselightbox" /><br/>
lightboxgroup: <xsl:value-of select="$lightboxgroup" /><br/><br/>
</xsl:if>
<img src="{umbraco.library:GetMedia($currentPage/imageid,'false')/umbracoFile}" />
</xsl:template>
</xsl:stylesheet>
input:
output variables:
imageid:/media/330/freighthandling.jpg15011344064jpg
thumbwidth: 100
align:
linktoorig: 1
uselightbox: 1
lightboxgroup:
However, when adding the <img> tag in the xlst, I'm getting an error: Error parsing XSLT file: \xslt\Thumbnail.xslt
Why? what goes wrong?
Try this
Getting the same error.. :(
<img>
<xsl:attribute name="src">
<xsl:text>ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="$imageid"/>
<xsl:text>&width=150&height=98%&constrain=true</xsl:text>
</xsl:attribute>
</img>
Code above works, but it fails on the image url. Instead of "/media/330/freighthandling.jpg", the imageid variable returns:
"/media/330/freighthandling.jpg15011344064jpg", which ofcourse results in an incorrect url
Hi Joel
Did you tried <xsl:value-of select="$imageid/umbracoFile"/>?
Thanks
Pnima
<xsl:if test="$imageid != '' ">
imageid:<xsl:value-of select="$imageid" /><br/>
thumbwidth: <xsl:value-of select="$thumbwidth" /><br/>
align: <xsl:value-of select="$align" /><br/>
linktoorig: <xsl:value-of select="$linktoorig" /><br/>
uselightbox: <xsl:value-of select="$uselightbox" /><br/>
lightboxgroup: <xsl:value-of select="$lightboxgroup" /><br/><br/>
<xsl:value-of select="$imageid/umbracoFile"/>
</xsl:if>
No error, but <xsl:value-of select="$imageid/umbracoFile"/> didn't gave any result
Try telling us what you get if you do this:
<textarea> <xsl:copy-of select="$imageid" /> </textarea>
It should give you the content of $imageid
Maybe try adding ?umbDebugShowTrace=true onto the end of your url. That way you should be able to get an idea of the error actually being thrown.
I think the issue is that $imageid won't have what you want in it. You'll want it to be a four digit ID of the image item. Could the issue be the name of the parameter you're passing in is different from what you expect? i.e you pass in umb_imageid="1091" but your expect /macro/imageid".
Gives the following results:
In that case this should work:
Finally :)
Sebas: you helped me finding the answer. The following tag returns the image correctly:
<img src="{$imageid/Image/umbracoFile}" alt="" border="0" />
Hi Joel
You might wanna try this package: XML Dump
It's really great when working with XML/XSLT
is working on a reply...