You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I add image sizing in the block editor, the sizing is overwritten by .wp-block-image img and html :where(img[class*=wp-image-]) CSS, which sets height: auto;.
Step-by-step reproduction instructions
Using 2023 theme and Gutenberg plugin, add a manual image size (ie-"59px") to an image. Publish the post and, when previewing the page, the image will not be resized.
Screenshots, screen recording, code snippet
When inspecting the image, this is what's seen
Environment info
WP 6.1.1
Gutenberg 15.1.1
Twenty-Twenty Three theme
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Hi @bbertucc - thanks for the report and the testing steps.
So far I have not been able to replicate the issue: on my end, the image block is resized as expected both in preview and after publication.
Tested with
WP 6.1.1
Gutenberg 15.2.4 active or inactive
No other plugins active
Twenty Twenty-Three 1.3
Screencast
tt3-image-block.mov
@bbertucc Could you please let me know the following:
Are you still able to replicate with Gutenberg either inactive, or updated to version 15.2.4?
When you say "add a manual image size" are you resizing the image in the same way I am in the screencast, namely by adding a value in the "Width" block in the Image block settings in the right-hand panel?
Could you please let me know if your issue only occurs when the Image block is within a Row block (or another block), or does it also occur when the Image block is not nested within another block?
@bbertucc - thanks so much for confirming so quickly.
I still haven't been able to replicate this in WP 6.1.1 with Gutenberg 15.2.4 either active or inactive, as you can see in this screencast where I resize images within a Columns block:
column-image.mov
Could you please test again under the following conditions and let me know how it goes:
Update Gutenberg to 15.2.4 - do you still see the issue?
Deactivate Gutenberg - do you still see the issue?
Deactivate all your plugins temporarily - do you still see the issue? You can use the Health Check plugin's troubleshooting mode for this, which will not change your live site. If the problem goes away, reactivate your plugins one by one (while still in troubleshooting mode) to find the culprit.
Could you please also provide a screencast so I can see exactly in what way you're resizing the images? Thanks!
In general I think the image block's interface could do with some work, because you can set a single dimension that should cause an image to lose its aspect ratio, but visually the image always keeps its aspect ratio until you actually modify both dimensions. It may be better to have a specific option for aspect ratio locking, which by default is enabled (so changing the height also changes the width).
Since this seems to be a longer standing issue and not directly related to problems in the 6.2 cycle, moving to 6.2.1 for consideration there. Big thanks to everyone for testing and reporting up!
But in the frontend the height is set on the image itself
<img .... height="600px">
So only when i uncheck the heights, the height from my core/image input is respected:
Since the minHeight dimension is currently not supported for images there is no way the get fixed image height unless i would crop my image the another ratio?
Or i have to wrap my image within a group with a minheight
Activity
kathrynwp commentedon Mar 7, 2023
Hi @bbertucc - thanks for the report and the testing steps.
So far I have not been able to replicate the issue: on my end, the image block is resized as expected both in preview and after publication.
Tested with
WP 6.1.1
Gutenberg 15.2.4 active or inactive
No other plugins active
Twenty Twenty-Three 1.3
Screencast
tt3-image-block.mov
@bbertucc Could you please let me know the following:
Thanks!
kathrynwp commentedon Mar 7, 2023
@bbertucc - Related to this issue:
#48295
Could you please let me know if your issue only occurs when the Image block is within a Row block (or another block), or does it also occur when the Image block is not nested within another block?
bbertucc commentedon Mar 7, 2023
Hey @kathrynwp - The problem only occurs inside a column block. Also note: the problem only shows up on the published version, not when editing.
kathrynwp commentedon Mar 7, 2023
@bbertucc - thanks so much for confirming so quickly.
I still haven't been able to replicate this in WP 6.1.1 with Gutenberg 15.2.4 either active or inactive, as you can see in this screencast where I resize images within a Columns block:
column-image.mov
Could you please test again under the following conditions and let me know how it goes:
Could you please also provide a screencast so I can see exactly in what way you're resizing the images? Thanks!
shreyasikhar commentedon Mar 8, 2023
Hello @kathrynwp and @bbertucc,
I am able to reproduce this issue. Please check the below screencast.
image-height-bug.mov
The issue is because the CSS
height: 300pxon<img>gets overridden withheight: autodue to higher specificity.kathrynwp commentedon Mar 13, 2023
Thanks, @shreyasikhar - that's the clue I needed.
I was able to replicate the issue when changing the height value on the image block. When changing the width value alone, the bug is not present.
kathrynwp commentedon Mar 13, 2023
Was also able to replicate in Twenty Seventeen, so the bug is not limited to classic themes.
Can also replicate with WP 6.2-RC1-55510, no plugins active.
ironprogrammer commentedon Mar 13, 2023
I can also reproduce this issue in WordPress 6.1.1 and 6.2-RC1 with no other plugins active.
talldan commentedon Mar 14, 2023
I could reproduce this one back as far as WordPress 5.9, so it seems like it has been a problem for a long time.
I think this PR might be the first to introduce an issue - CSS: Add a reset for image heights. It added the
height: autostyle.But it seems like these two PRs also added additional
height: autostyles:In general I think the image block's interface could do with some work, because you can set a single dimension that should cause an image to lose its aspect ratio, but visually the image always keeps its aspect ratio until you actually modify both dimensions. It may be better to have a specific option for aspect ratio locking, which by default is enabled (so changing the height also changes the width).
annezazu commentedon Mar 14, 2023
Since this seems to be a longer standing issue and not directly related to problems in the 6.2 cycle, moving to 6.2.1 for consideration there. Big thanks to everyone for testing and reporting up!
merijnponzo commentedon Apr 12, 2023
In the gutenberg editor it works because the image height is set on the parent element
But in the frontend the height is set on the image itself
So only when i uncheck the heights, the height from my core/image input is respected:
Since the minHeight dimension is currently not supported for images there is no way the get fixed image height unless i would crop my image the another ratio?
Or i have to wrap my image within a group with a minheight
youknowriad commentedon Sep 16, 2026
Re-tested on trunk: a manually sized Image block renders at the chosen width with a proportional height on the front end. Closing as fixed.