<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html id="stopWindow" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <style type="text/css"> 
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
<script type="text/javascript">  
function changeImageManager(editor,args)  
{  
        if (args.get_commandName() == "ImageManager")  
        {  
            var callbackFunction = function(sender, args)  
            {  
                //result holds the image element 
                var result = Telerik.Web.UI.Editor.Utils.getOuterHtml(args.get_value());  
                
                var div = document.createElement("DIV");  
                Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, result);  
                
                //First child must be the image!  
                var img = div.firstChild;      
                 
                div.style.overflow = "hidden";  
                div.style.width = "1px";  
                div.style.height = "1px";  
                  
                document.body.appendChild(div);    
                //GET THE IMAGE SIZE  
                alert(img.offsetWidth  + " -- " + img.offsetHeight);  

                editor.pasteHtml(div.innerHTML, "ImageManager");  
            };  
            args.set_callbackFunction(callbackFunction);  
        }  
}  
</script>  
 
<telerik:radeditor runat="server" ID="RadEditor1" OnClientCommandExecuting="changeImageManager"> 
    <ImageManager ViewPaths="~/images" UploadPaths="~/images" /> 
</telerik:radeditor>   

    </form>
</body>
</html>
