Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • keilo 568 posts 1023 karma points
    Sep 22, 2015 @ 16:45
    keilo
    0

    TinyMCE Image Width and Height attributes

    In TinymCE, if one insert an image or resizes it, the width and height properties gets edited inside the style="width:...; height:..." along with the image resizer params ?width=...&height=...

    My question is how do I get it to use/update the Width="" and Height="" attributes of the IMG tag ?

    Example:

    instead of

    < img style="width:580px; height:200px" src="... ?width=580&height=200"

    how do i get it to do this (in width and height attributes)

    < img width="580" height="200" src="... ?width=580&height=200"

    This is apparently very important if the content gets send as an email and Outlook requires the width and height attributes to be defined explicitly, if not it behaves strange.

    Where do I go about editing this?

    Any guidance would be much appreciated!

  • keilo 568 posts 1023 karma points
    Sep 22, 2015 @ 17:29
    keilo
    0

    After some research I found this article

    http://www.logikfabrik.se/blog/responsive-images-in-umbraco/

    where it covers editing umbraco.services.js, in \Umbraco\Js\

    on line 5243 of this file, if you add the following code;

    editor.dom.setAttrib(imgElm, 'width', newSize.width);
    editor.dom.setAttrib(imgElm, 'height', newSize.height);
    

    Then it will set the Width and Height attributes of the Image explicitly. This is done on Umbraco version 7.1.8 install, and I am fully aware of the consequences of doing such change - nevertheless its required for editing content inside the tinymce for sending as e-mail (outlook compatibility).

    Hope this is useful for others looking for the same.

    If you think there is a particular concern with such edit, or the article linked above, please do share your thougths.

Please Sign in or register to post replies

Write your reply to:

Draft