One solution might be to run all your RTE content through some helper function/template, that parses for images and adjusts the path as necessary. There are a couple methods I've used to do similar functions:
Thanks for that Tom, pretty much exactly what i should be doing, didn't even cross my mind to do that, I was expecting to edit the core and all sorts lol
Prefix RTE Images
Hi,
Does anyone know how i could prefix the url of all images inserted using the RTE within the umbraco backend?
Basically, I want to presfix them something like /rte/media/123/image.jpg and then using some urlrewriting to process them using imagegen.
Anyone done anything similar to this?
Thanks
John
Hi John,
One solution might be to run all your RTE content through some helper function/template, that parses for images and adjusts the path as necessary. There are a couple methods I've used to do similar functions:
- Transforming WYSIWYG output with XSLT [blog]
- Use the HtmlAgilityPack - example: Wrapping Images using the Html Agility Pack, TinyMce, Umbraco [blog]
HTH,
Tom
Thanks for that Tom, pretty much exactly what i should be doing, didn't even cross my mind to do that, I was expecting to edit the core and all sorts lol
I have made a simpe xslt entensive to this.
<code>
<msxml:script language="C#" implements-prefix="myfunc">
<![CDATA[
public string ImagePrefix(string Value)
{
return Value.Replace("img src=\"", "img src=\"http://www.mydomain.dk/rte");
}
]]>
</msxml:script>
</code>
Remenber to include :
xmlns:gitsfunc="urn:myfunc"
exclude-result-prefixes="msxml .... myfunc"
Cheers
Jan Borup Coyle
Forgot the Body render:
<xsl:value-of select="concat('<![CDATA[ ', myfunc:ImagePrefix(./bodyText),']]>')" disable-output-escaping="yes"/>
is working on a reply...