That looks pretty good. What do you get for output to your browser's source code when you run this?
There's a lot of escaping and quote marks to contend with, though. It might be easier and clearer in the end to write a short macro rather than trying to do it all inline?
Using Imagegen in inline xslt
Im trying to add imagegen to an image in inline xslt but suspects that I have a syntax error somewhere:
That looks pretty good. What do you get for output to your browser's source code when you run this?
There's a lot of escaping and quote marks to contend with, though. It might be easier and clearer in the end to write a short macro rather than trying to do it all inline?
cheers,
doug.
I get no output at all which is really annoying :)
Yes doing a macro would probably be better but how do I best achieve it?
The user should pick an image with media Picker with preview. So I want the macro to pick up the selected image. How can I do that from my template?
don't forget the goofy escaping with the ampersands in the inline calls... --> &
<umbraco:Item runat="server" field="lowerPageImage" xslt="concat('<img src="/umbraco/imageGen.ashx?image=',umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '&amp;width=200&amp;constrain=true" />')" xsltDisableEscaping="true"/>
also, here is my generic xslt for displaying a media picker 'pageImage' from my docType, on the template...
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:if test="$currentPage/data [@alias = 'pageImage'] != ''">
<xsl:variable name="imageNode" select="$currentPage/data[@alias='pageImage']"/>
<xsl:variable name="imageData" select="umbraco.library:GetMedia($imageNode,0)/data [@alias = 'umbracoFile']"/>
<img src="/umbraco/imagegen.ashx?image={$imageData}&width=525&constrain=true" />
</xsl:if>
</xsl:template>
Once again you guys saved me :) It was the ampersandsd that made the trick. Thank you!
is working on a reply...