Skip to content
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

in Image Block the image size in drop down is not proper as per image dimension #27198

Closed
kmadhak opened this issue Nov 23, 2020 · 10 comments · Fixed by #32364
Closed

in Image Block the image size in drop down is not proper as per image dimension #27198

kmadhak opened this issue Nov 23, 2020 · 10 comments · Fixed by #32364
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@kmadhak
Copy link

kmadhak commented Nov 23, 2020

Describe the bug
in Image Block the image size in drop down is not proper as per there dimension

Steps to reproduce the behaviour:

  1. Go to 'Editor'
  2. Add new page
  3. Click on 'add block'
  4. Select the block 'Image'
  5. Add images in Image block
  6. View the options of 'Image size' drop down
  7. See error

Expected behaviour
selection of image size in drop down should be as per image dimension

Video
for more detail please view the attached video
https://www.loom.com/share/856447be04f644939b184032969d5de8

Editor version:
WordPress version: 5.6-RC1

Desktop:
OS: Windows
Browser chrome
Version 86.0.4240.193 (Official Build) (64-bit)

@ntsekouras ntsekouras added the [Block] Image Affects the Image Block label Nov 23, 2020
@paaljoachim
Copy link
Contributor

Thank you very much for adding this issue, @kmadhak Kunal!

I am testing on a Mac running OSX 10.15.7
WordPress 5.6
Gutenberg plugin 9.5.2.
Themes: Twenty Twenty One as well as Twenty Twenty

I made a new page. Clicked the inserter. Added an Image block. Added an image with dimensions 2560 x 1707.
It came in as a Large image (not thumbnail).

I tested another image with dimensions 1600x1200. It came in as a Large image.


Deactivating the Gutenberg plugin. I see the same result.

Please retest and let us know how it is working. Do also test out Twenty Twenty or Twenty Twenty One themes to see if you get the error there. Then test the theme you are using to see if there is any difference.

Thank you!

@kmadhak
Copy link
Author

kmadhak commented Dec 17, 2020

Hello @paaljoachim paaljoachim,

Thanks for the replay.

I have checked with the WordPress version 5.6 in a theme "Twenty Twenty One" and "Twenty Twenty" and it is regenerating, for more detail please view the attached video.

Video with Twenty Twenty One theme: https://www.loom.com/share/c174a279a3db4ceca27916ddb6ce4a01

Video with Twenty Twenty theme: https://www.loom.com/share/46d25802113a41bfa9873f7f538f2fbf

Please look into it and let me know if you have any query.

Thank you.

@paaljoachim
Copy link
Contributor

paaljoachim commented Dec 17, 2020

Thank you @kmadhak Kunal!
I now understand! This is a bug. Thank you for reporting it! I will also need to see if this has been reported before. By searching for Image block here on the Gutenberg repo and checking out various issues.

Some examples.
Adding a 1754x1240 image.
Shows Image size as Large.

Adding a 758x411 image. (I also tried with a 600x600 image with the same result.)
Shows Image size as Thumbnail but the Gutenberg layout preview shows the image as Full Size.
This can clearly be seen when changing the Image sizes.

Screen Shot 2020-12-17 at 18 38 52

Using theme Twenty Twenty.
WordPress 5.6
Gutenberg plugin 9.5.2.

Btw
We will also need to add a new bug report for the Replace panel that shows the horizontal scrollbar.
That is added here: #27788

@mrwweb
Copy link

mrwweb commented Mar 16, 2021

I ran into this issue today. Running 5.7 with a child theme of Twenty Twenty.

It feels like it might be a regression from #21681

@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 16, 2021

Thanks for reporting it, Mark!

@jeyip Jeremy.
Using WordPress 5.7
Twenty Twenty theme.
No active plugins.

I went to an existing page.
Added the Image block.
Added an image at 539x554.
The layout showed a large image, but the drop down said thumbnail.
I changed to a large in the drop down and noticed no change in the layout.
Then changed to thumbnail in the drop down and noticed the layout change the image to a thumbnail size.

Bottom line as I noticed it is that adding a smaller image. The layout will show a large image but the drop down will say thumbnail.

@ninetyninew
Copy link

Same issue here, was fixed before in #21681. Also can I just check, should the sizes in the image block for Thumbnail, Medium, Full Size be the same as in WordPress > Media settings or are they different sizes unique to the block? On my installation they don't match.

@Mamaduka
Copy link
Member

I also noticed this and was able to track down the source of the issue.

Incorrect image size is selected when WP doesn't generate an image for the default size, and usually, this is a large. But the block will still use this default image size to set the sizeSlug attribute.

The ImageSizeControl only includes sizes available for the media + "Full Size". When the "Large" image isn't available, but sizeSlug points to it, control will fall back to the first option - "Thumbnail."

TL;DR - If WP didn't generate the default image size, the ImageSizeControl should fall back to "Full Size."

I'm not sure what's the best solution for this, but I will create PR as soon as I've something.

@Mamaduka
Copy link
Member

Mamaduka commented Jun 1, 2021

PR is ready for testing #32364.

@kmadhak
Copy link
Author

kmadhak commented Jun 15, 2021

Hello @george Mamadashvili,

Greetings of the day!!!

I would like to know the progress of this issue, please let me know if you need more detail on it.

Thank you.

@Mamaduka
Copy link
Member

Hi, @kmadhak

The PR is ready and waiting for a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants