+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Bug while inserting images in IE

Bug while inserting images in IE

4 posts, 0 answered
  1. Paul
    Paul avatar
    176 posts
    Registered:
    18 Nov 2008
    21 Jan 2010
    Link to this post

    Hi!

    I found some bug while work in Internet Explorer. When I edit some content item and insert some image all works correctly for the content item but if I use Internet Explorer in <img /> tag I get fixed width and height. In other browsers all works fine. If I want to change image size in library I also need to change size in content item.

    Can you explain this problem?

    Thank you. 

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jan 2010
    Link to this post
    Hello Paul,

    Thank you for posting your question. 

    Could you please try to elaborate on the problem, or provide us with the exact steps that you are following? You could also share some screenshots. I am not sure that I got the situation correctly and what to be sure about the test case, so we could provide you with the best possible response. 

    Thank you in advance.  

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Paul
    Paul avatar
    176 posts
    Registered:
    18 Nov 2008
    21 Jan 2010
    Link to this post

    Hi Georgi!

    Let me explain step by step:

    1. First I create simple generic content item in Internet Explorer.

    2. After that I insert in content item image with tool "Insert image".

    3. I choose my image which I loaded before.

    4. I save my content item.

    Now if you open this generic content item again you can see that <img> tag has fixed width and height. And this is a bug. In other browsers(Firefox, Chrome) all works fine and <img> tag doesn't have any fixed width or height. This bug is bad for me when I need to change size of my image in image library.

    Thank you.

  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jan 2010
    Link to this post
    Hi Paul,Thank you for the additional details.

    I have saw the problem. Here is a quick fix that you can apply:

    1. Map the templates which are using the RadEditor. 

    2. Find the following function:

    Telerik.Web.UI.Editor.CommandList["LibraryImageManager"] = function(commandName, editor, args)

    Change it as follows:
             Telerik.Web.UI.Editor.CommandList["LibraryImageManager"] = function(commandName, editor, args) {
                 var editorArgs = editor.getSelectedElement();
                 if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
                     editorArgs = editor.getSelection();
     
                 var myCallbackFunction = function(sender, args) {
                     if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "IMG")
                         args.parentNode.replaceChild(editorArgs, args);
                     else {
                         var cloned = args.cloneNode(true);
                         var div = args.ownerDocument.createElement("DIV");
                         div.appendChild(cloned);
     
                         div.innerHTML = div.innerHTML.replace(/width=\d{1,5}/i, "");
                         div.innerHTML = div.innerHTML.replace(/height=\d{1,5}/i, "");
     
                         editorArgs.pasteHtml(div.innerHTML);
                     }
                 }
                 var path = '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx") %>';
                 editor.showExternalDialog(
    path,
    editorArgs,
    750,
    515,
    myCallbackFunction,
    null,
    'ImageLibraryDialog',
    true,
    Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
    false,
    true)
             };

    Note the highlighted code - this is the change. We are adding regular expression search & replace, to match the static width and height and remove them. 

    We will check what is the root cause, and will try to fix it for the service pack. 

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered