I'm looking to have ImageGen automatically used in the Content Editor. All the documentation seemed to point to the XSLT. My problem is that I want the client to upload images to the media folder and then use them by clicking the media icon in the content editor. Basically, I'm going on the assumption that they're not going to resize them and then upload a large image and then try to shrink it using the width and height options in the 'Insert/Edit Media' modal.
I was thinking about creating a macro that they could use to select the media and then also to have fields to resize, curve the corners etc.
Has anyone tried this? Is there a better way to do this?
I use the macro option with the following xslt. I only allow the user to pick an image, set the width (so I can constrain the proportions) and alt text. Hope this helps.
Thanks for the XSLT. I hadn't seen this....so I created my own. A few more parameters. Added height (althought it is still automatically constraining), alignment (although I'd love the macro property to be a dropdown....), and ability to make it a thumbnail with a link to the larger image.
Automatically use ImageGen in Content Editor
I'm looking to have ImageGen automatically used in the Content Editor. All the documentation seemed to point to the XSLT. My problem is that I want the client to upload images to the media folder and then use them by clicking the media icon in the content editor. Basically, I'm going on the assumption that they're not going to resize them and then upload a large image and then try to shrink it using the width and height options in the 'Insert/Edit Media' modal.
I was thinking about creating a macro that they could use to select the media and then also to have fields to resize, curve the corners etc.
Has anyone tried this? Is there a better way to do this?
Thanks,
Chad
The macro is the way to go. No direct way to use ImageGen from within the Richtext Editor.
cheers,
doug.
Hi Chad
I use the macro option with the following xslt. I only allow the user to pick an image, set the width (so I can constrain the proportions) and alt text. Hope this helps.
Cheers
Evan
<xsl:param name="currentPage"/>
<xsl:variable name="mediaCurrent" select="/macro/mediaCurrent"/>
<xsl:variable name="imageWidth" select="/macro/imageWidth"/>
<xsl:variable name="imageAlt" select="/macro/imageAlt"/>
<xsl:template match="/">
<xsl:variable name="imgUrl" select="$mediaCurrent/node/data [@alias='umbracoFile']"/>
<xsl:if test="$imgUrl != ''">
<img>
<xsl:attribute name="src">
<xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="$imgUrl"/>
<xsl:text>&constrain=true</xsl:text>
<xsl:text>&width=</xsl:text>
<xsl:value-of select="$imageWidth"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$imageAlt"/>
</xsl:attribute>
</img>
</xsl:if>
</xsl:template>
Thanks for the XSLT. I hadn't seen this....so I created my own. A few more parameters. Added height (althought it is still automatically constraining), alignment (although I'd love the macro property to be a dropdown....), and ability to make it a thumbnail with a link to the larger image.
What is happening if I keep getting a blank URL?
is working on a reply...