This is a migrated thread and some comments may be shown as answers.

Image path problem

1 Answer 148 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Daud
Top achievements
Rank 1
Daud asked on 14 Feb 2011, 07:48 AM
Hi,
My application images folder is ~/Images
and the rad editor is in a file that has the heirarchy: ~/Admin/pageedit.aspx
When I insert any image and see its html it becomes <img src="/images/abc.jpg" .... >

I want that the image path should be shown as <img src="images/abc.jpg"...>

I have tried this and almost done on OnClientCommandExecuting using javascript. The path shown becomes OK but the image is shown as broken, as the image path becomes wrong (i.e. abc.jpg has relative path "../images/abc.jpg").

Can you help me about this problem?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Feb 2011, 05:05 PM
Hi Daud,

By default, RadEditor generates images with relative paths and if the images folder is mapped as a virtual folder pointing to the root of both sites in IIS then the images will be rendered without problems in the editor and in the public site.

Another approach is to enable the MakeUrlsAbsolute filter of RadEditor:
RadEditor1.EnableFilter(Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute);
which will make all src attributes in the editor content have absolute URLs.
After that using String.Replace on the server, you will be able to replace or strip the desired part of the URL and therefore display the image correctly on the public site.

If you want to have more precise URL stripping you could implement your own custom content filter that will convert the absolute paths to relative when switching to HTML mode or submitting the content by firing the Telerik.Web.UI.Editor.StripPathsFilter([domainName]); filter of RadEditor.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Daud
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or