More in this section

Forums / Developing with Sitefinity / Image property editor problem

Image property editor problem

2 posts, 1 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    04 May 2005
    10 Dec 2009
    Link to this post

    One of my users made a blog entry, and added an image. They set a height and width for the image by right-clicking the image and choosing "Properties...". This height and width is assigned in the image's style attribute, and I want this to be assigned in the image's height and width attributes instead. 

    I've been looking through the project and I can't figure out how to begin editing this. Help?

    Attached: Screenshot of the dialog I'm talking about.

    Michael Snyder
    Web Developer | Connections Academy
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    11 Dec 2009
    Link to this post

    You need to subscribe for OnClientSubmit event  of RadEditor and add the following js logic which will set  Width and Height as separate attributes.

    <script type="text/javascript">
        function OnClientSubmit(editor) {
            var document = editor.get_document();
            //get reference to the Image tag
            var images = document.getElementsByTagName("IMG");
            for (i = 0; i < images.length; i++) {
                var image = images[i];
                // GET THE WIDTH AND HEIGHT
                var width = image.width;
                var height = image.height;
                image.setAttribute("width", width);
                image.setAttribute("height", height);

    More information at OnClientSubmit

    Ivan Dimitrov
    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.
2 posts, 1 answered