Replacement Images inherit original image's height and width.

Last post 04-28-2005, 2:35 AM by paoloa. 0 replies.
Sort Posts: Previous Next
  •  04-28-2005, 2:35 AM 6210

    Replacement Images inherit original image's height and width.

    I noticed an issue when you want to replace an existing image with a new one.

    You first double click the image to be replaced and the insert image dialog box pops up.

    The width and height boxes are populated even though the IMG tag in the HTML didnt actually contain the width= or height= attributes.  It seems that IE determines the image size and automatically assigns the image.width and image.height for you.  This can cause problems as selecting a new image to replace the old one will leave it forced to the size of the original image.

    to get around this i have replace the following javascript lines in insert_image.asp:

    v_Width = oControl.width;
    v_Height = oControl.height;

    with

    v_Width =  (oControl.outerHTML.toLowerCase().indexOf("width=")!=-1 ? oControl.width : "");
    v_Height =  (oControl.outerHTML.toLowerCase().indexOf("height=")!=-1 ? oControl.height : "");

    Not a great solutions but it works.  Now the width/height boxes are only populated if the original HTML contained the IMG tag HEIGHT/WIDTH attributes.
     
    Can anyone think of a better solution?
View as RSS news feed in XML