Image path problem

2 posts, 0 answers
  1. Daud
    Daud avatar
    9 posts
    Member since:
    Dec 2010

    Posted 14 Feb 2011 Link to this post

    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?
  2. Rumen
    Rumen avatar
    14285 posts

    Posted 16 Feb 2011 Link to this post

    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:
    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,
    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.
Back to Top