jquery - Redactor image resize adding inline style attributes, how to force redactor to use "width" and "height" attributes -
redactor adding style attribute img tag while resizing
<img src="image_url" style="width: 189.00884955752213px; height: 118px;" >
this inline css not affecting image size when viewing in outlook desktop app.
after doing research found outlook show image in required size if size specified in image tag width & height attributes.
and width value in style attribute generated redactor not integer 189.00884955752213px.
how fix these 2 issues
i resolved issue using syncbeforecallback method make sure image had width attribute outlook
syncbeforecallback: function (html) { // set image width attribute (for outlook) var $html = $('<div/>').html(html); $html.find('img').each(function copyimagecsswidthtoattribute() { var width = parseint($(this).css('width')); if (width > 0) { $(this).attr('width', width); } }); html = $html.html(); return html; },
i didn't find case height defined.
Comments
Post a Comment