# Wrong version of picture displayed by img src code... error in code?

**URL:** <https://discourse.gohugo.io/t/wrong-version-of-picture-displayed-by-img-src-code-error-in-code/45162>\
**Category:** support\
**Created:** [July 5, 2023, 8:54pm UTC](https://discourse.gohugo.io/t/wrong-version-of-picture-displayed-by-img-src-code-error-in-code/45162 "2023-07-05T20:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Durand](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tom_durand/32/14460_2.png) [@Tom\_Durand](https://discourse.gohugo.io/u/Tom_Durand)\
**Post date:** [July 5, 2023, 8:54pm UTC](https://discourse.gohugo.io/t/wrong-version-of-picture-displayed-by-img-src-code-error-in-code/45162/1 "2023-07-05T20:54:14Z")

</div>

Hi,  
I have a similar issue to the one I had before, in my responsive img the chosen version displayed makes no sense, it’s too big for the displayed dimensions. Not systematically wrong or too big, but very often. In the case at hand the dimensions are “width: 353.625” and the image displayed is [http://localhost:1313/Images/spirituality/joy\_et\_joan\_hud0788d786452a701285dba7c2763d6b4\_745198\_604x0\_resize\_q92\_h2\_lanczos\_2.webp](http://localhost:1313/Images/spirituality/joy_et_joan_hud0788d786452a701285dba7c2763d6b4_745198_604x0_resize_q92_h2_lanczos_2.webp)  
Output:

```auto
<img src="http://localhost:1313/Images/spirituality/joy_et_joan.webp" srcset="http://localhost:1313/Images/spirituality/joy_et_joan_hud0788d786452a701285dba7c2763d6b4_745198_200x0_resize_q92_h2_lanczos_2.webp 200w, http://localhost:1313/Images/spirituality/joy_et_joan_hud0788d786452a701285dba7c2763d6b4_745198_400x0_resize_q92_h2_lanczos_2.webp 400w, http://localhost:1313/Images/spirituality/joy_et_joan_hud0788d786452a701285dba7c2763d6b4_745198_604x0_resize_q92_h2_lanczos_2.webp 604w, http://localhost:1313/Images/spirituality/joy_et_joan.webp 800w" width="800" height="1131" loading="lazy" alt="dd" title="Joy &amp; Joan" sizes="(max-width: 400px) 100vw, (max-width: 604px) 50vw, 35vw" style="max-width:800px;">

```

Atributes renderhook:

```auto
sizes="(max-width: 400px) 100vw, (max-width: 604px) {{if in .Attributes.class "center"}}100vw, 70vw{{else}}50vw, 35vw{{end}}" {{with $img}}style="max-width:{{.Width}}px;max-height:min({{.Height}}px, 500px)"{{end}}></a>

```

As you see Did I misunderstand my own code ? You can see the logical (and intended behavior) should be to pick the 400px wide image, obviously. theoretically this is a html problem… But in practice really about hugo syntax.

Btw, in the output pasted here the max-height property in style is ignored… any idea why ? It doesn’t happen everywhere.
