Sitecore 8.1 MVC Glass Mapper v4 ImageField displays the height and width attribute in the Page Editor

We are using GlassMapper 4.0.5.54 in Sitecore 8.1 Update 1 MVC. The problem is that when rendering ImageField, the height and width attributes are written to the img tag - but only in page editor mode.

We tried different approaches like

@Html.Glass().RenderImage(Model, x=> x.ImageField, outputHeightWidth:false, isEditable:true, parameters:new {mw = 1218, mh = 530}) @Html.Glass().Editable(x => x.ImageField, new { mw = 1218, mh = 530, width = (string)null, height = (string)null }) 

But we always get

 <img src="http://url_to_local_website/-/media/image_1218x530.jpg?h=530&amp;la=en&amp;mh=530&amp;mw=1218&amp;w=1216&amp;hash=452505F9D5896956CB6B0F284755555217E62D8A" alt="Alt Text" width="1216" height="530" sc-part-of="field" class="scEnabledChrome"> 

Thus, even when using the explicit parameter outputHeightWidth:false it displays the width and height attributes in the Page Editor and distorts the image. Any suggestions? Or is this a mistake?

In a Glass Mapper ImageParameters comment, someone else mentions the same behavior. But there is no answer to it.

+5
source share

Source: https://habr.com/ru/post/1241010/


All Articles