RadEditor ImageManager Paths

3 posts, 0 answers
  1. nickJr
    nickJr avatar
    18 posts
    Member since:
    Jul 2007

    Posted 18 Feb 2010 Link to this post

    I am developing an internal web application and when I upload an image using RadEditor Imageupload, it successfully gets uploaded to a virtual directory in the web application. The application creates a document and it can be viewed by anyone outside the network.

    So when I insert the images, it reference the virtual directory which is only accessible internally.
    So when people outside the network views the document, they are unable to see the images in the document since the image reference is set to the virtual folder.

    I can copy the images in the virtual folder to a folder that is accessible from www. In that case how can I change the image reference to point to the external image.

    for example.
    Image upload folder in only Internal
    ~/images/a.jpg

    I can copy this a.jpg to another server which is available externally.
    Say I copy access the image using
    www.test.org/images/a.jpg

    How can I change the image reference from ~/images/a.jpg to www.test.org/images/a.jpg/

    please let me know.
    thanks

  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 22 Feb 2010 Link to this post

    Hi Pra,

    You can achieve this by modifying the output of ImageManager and registering a callback function. The following example demonstrates how to assign a callback function to ImageManager:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientCommandExecuting="OnClientCommandExecuting">
    </telerik:RadEditor>
     
    <script type="text/javascript">
     
        function OnClientCommandExecuting(editor, args)
        {
            if (args.get_commandName() == "ImageManager")
            {
     
                var callbackFunction = function(sender, args)
                {
                    var result = args.get_value(); //get returned value of ImageManager which is IMG element
                    result.src = "http://www.test.org/images/" + result.src.substring(result.src.lastIndexOf("/") + 1, result.src.length);
     
                    result = Telerik.Web.UI.Editor.Utils.getOuterHtml(result); //get HTML source of the DOM element
     
                    editor.pasteHtml(result, "ImageManager");
                };
     
                args.set_callbackFunction(callbackFunction); //register callback function
            }
        }           
    </script>

    I hope this helps.

    Sincerely yours,
    Dobromir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. nickJr
    nickJr avatar
    18 posts
    Member since:
    Jul 2007

    Posted 22 Feb 2010 Link to this post

    Hi Dobromir,
     
    Thanks for the posting.

    Your solution worked exactly the way I wanted.

    Thanks again!
    pra
Back to Top