-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default Image CSS overwriting Image Sizing #48762
Comments
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 withWP 6.1.1 Screencasttt3-image-block.mov@bbertucc Could you please let me know the following:
Thanks! |
Hey @kathrynwp - The problem only occurs inside a column block. Also note: the problem only shows up on the published version, not when editing. |
@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.movCould 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! |
Hello @kathrynwp and @bbertucc, I am able to reproduce this issue. Please check the below screencast. image-height-bug.movThe issue is because the CSS |
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. |
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. |
I can also reproduce this issue in WordPress 6.1.1 and 6.2-RC1 with no other plugins active. |
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 But it seems like these two PRs also added additional
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! |
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 |
Description
When I add image sizing in the block editor, the sizing is overwritten by
.wp-block-image img
andhtml :where(img[class*=wp-image-])
CSS, which setsheight: 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
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: