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,
For some reason the image is not showing when I include in my Xslt code the querystring parameter for width:
<img style="float:right;" src="ImageGen.ashx?image={umbraco.library:GetMedia($currentPage/publicationImage, false())/umbracoFile}&width=150" alt="cover image" />
If I omit the width parameter, my image is rendering on the page
<img style="float:right;" src="ImageGen.ashx?image={umbraco.library:GetMedia($currentPage/publicationImage, false())/umbracoFile}" alt="cover image" />
Does anybody know what's going on?
thanks for your help,
Anthony Candaele
I restate my problem, apparently the image is not rendering with ImageGen altogether. Only if I omit ImageGen.ashx?image= the image is rendered on the page.
Hey Anthony,
Usually I would get the media first then do the imageGen code, something like
<xsl:variable name="mediaId" select="number($currentPage/publicationImage)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="imageGen.ashx?image={$mediaNode/umbracoFile}&width={$mediaNode/umbracoWidth}&height={$mediaNode/umbracoHeight}" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" />
</xsl:if>
Rich
Hi Rich,
That's some clever code. I always checked for an image like this:
<xsl:if test="string-length(image) > 0">
<img .... />
But I guess your code is more robust.
However, the image still doesn't get rendered. From the moment I omit the ImageGen code the image does get rendered:
<xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img style="float:right;" src="{$mediaNode/umbracoFile}" alt="cover image" /> </xsl:if></xsl:if>
Strange indeed ...
greetings,Anthony
Hey,
What happens if you just call an image using imagegen in the browser, like?
http://YourDomain.com/imageGen.ashx?image=/media/100/someimage.jpg
I tried this out and the image gets rendered
Can you post the HTML source of the image when you've rendered it via XSLT.
Problem solved, apparently I had to add a '/' before imageGen.ashx like this:
src="/imageGen.ashx?image={$mediaNode/umbracoFile}&width=150" alt="cover image" />
Anyway, thanks for your help, I learned something new from your code for checking the presence of an image node.
Anthony
That'll do it, glad you got it working :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
problem with ImageGen
Hi,
For some reason the image is not showing when I include in my Xslt code the querystring parameter for width:
<img style="float:right;" src="ImageGen.ashx?image={umbraco.library:GetMedia($currentPage/publicationImage, false())/umbracoFile}&width=150" alt="cover image" />
If I omit the width parameter, my image is rendering on the page
<img style="float:right;" src="ImageGen.ashx?image={umbraco.library:GetMedia($currentPage/publicationImage, false())/umbracoFile}" alt="cover image" />
Does anybody know what's going on?
thanks for your help,
Anthony Candaele
I restate my problem, apparently the image is not rendering with ImageGen altogether. Only if I omit ImageGen.ashx?image= the image is rendered on the page.
Hey Anthony,
Usually I would get the media first then do the imageGen code, something like
<xsl:variable name="mediaId" select="number($currentPage/publicationImage)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="imageGen.ashx?image={$mediaNode/umbracoFile}&width={$mediaNode/umbracoWidth}&height={$mediaNode/umbracoHeight}" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" />
</xsl:if>
</xsl:if>
Rich
Hi Rich,
That's some clever code. I always checked for an image like this:
<xsl:if test="string-length(image) > 0">
<img .... />
</xsl:if>
But I guess your code is more robust.
However, the image still doesn't get rendered. From the moment I omit the ImageGen code the image does get rendered:
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img style="float:right;" src="{$mediaNode/umbracoFile}" alt="cover image" />
</xsl:if>
</xsl:if>
Strange indeed ...
greetings,
Anthony
Hey,
What happens if you just call an image using imagegen in the browser, like?
Rich
I tried this out and the image gets rendered
Can you post the HTML source of the image when you've rendered it via XSLT.
Rich
Hi Rich,
Problem solved, apparently I had to add a '/' before imageGen.ashx like this:
src="/imageGen.ashx?image={$mediaNode/umbracoFile}&width=150" alt="cover image" />
Anyway, thanks for your help, I learned something new from your code for checking the presence of an image node.
Anthony
That'll do it, glad you got it working :)
Rich
is working on a reply...