I need the editor to give me the full path to images etc from the editor which it currently doesnt do.
Ive tried setting "relativeurls", "removescripthost" and "converturls" all to 0 in tinymce.js and tinymcesrc.js (in umbracoclient\tinymce3) which seems to do absolutely nothing.
/// <summary>
/// Add an absolute path to all the img tags in the html of an e-mail.
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
private static string AddImgAbsolutePath(string html)
{
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
var uri = new Uri(HttpContext.Current.Request.Url.AbsoluteUri);
var domainUrl = string.Format("{0}://{1}", uri.Scheme, uri.Authority);
if (doc.DocumentNode.SelectNodes("//img[@src]") != null)
{
foreach (HtmlNode img in doc.DocumentNode.SelectNodes("//img[@src]"))
{
HtmlAttribute att = img.Attributes["src"];
if (att.Value.StartsWith("/"))
{
att.Value = domainUrl + att.Value;
}
}
}
return doc.DocumentNode.InnerHtml;
}
The Hybrid Framework is not a package, but a complete website. Just paste that code in your own project and use it each time you want to have full url's for media.
Do you have a project with some custom code? You could place it in there or in the App_Code folder. Than when you want to render the HTML of the RTE first let it go through that method. Something like this in Razor:
Although there must be a simpler way though surely, via some form of method I was trying previously? I've seen so many posts of various forums saying that method ususually works?
Tiny MCE not giving full URL
I need the editor to give me the full path to images etc from the editor which it currently doesnt do.
Ive tried setting "relativeurls", "removescripthost" and "converturls" all to 0 in tinymce.js and tinymcesrc.js (in umbracoclient\tinymce3) which seems to do absolutely nothing.
Has anyone had this issue before?
Thanks
In the Hybrid Framework I have a method for this:
If you use that all media will have full url's.
Jeroen
That package seems to suggest its compatible with v6.1 this site im working on is an older v4.7.1 site which I forgot to inclide!
The Hybrid Framework is not a package, but a complete website. Just paste that code in your own project and use it each time you want to have full url's for media.
Jeroen
Where abouts would this go?
Do you have a project with some custom code? You could place it in there or in the App_Code folder. Than when you want to render the HTML of the RTE first let it go through that method. Something like this in Razor:
Jeroen
Thanks I'll look at that
Although there must be a simpler way though surely, via some form of method I was trying previously? I've seen so many posts of various forums saying that method ususually works?
is working on a reply...