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

RadEditor ImageManager Paths

2 Answers 109 Views
Editor
This is a migrated thread and some comments may be shown as answers.
nickJr
Top achievements
Rank 1
nickJr asked on 18 Feb 2010, 07:08 PM
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 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 22 Feb 2010, 12:35 PM
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.
0
nickJr
Top achievements
Rank 1
answered on 22 Feb 2010, 03:40 PM
Hi Dobromir,
 
Thanks for the posting.

Your solution worked exactly the way I wanted.

Thanks again!
pra
Tags
Editor
Asked by
nickJr
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
nickJr
Top achievements
Rank 1
Share this question
or