gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

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

Open kmadhak opened this issue 6 years ago • 10 comments

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)

kmadhak avatar Nov 23 '20 12:11 kmadhak

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!

paaljoachim avatar Dec 16 '20 12:12 paaljoachim

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.

kmadhak avatar Dec 17 '20 06:12 kmadhak

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: https://github.com/WordPress/gutenberg/issues/27788

paaljoachim avatar Dec 17 '20 18:12 paaljoachim

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

mrwweb avatar Mar 16 '21 20:03 mrwweb

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.

paaljoachim avatar Mar 16 '21 21:03 paaljoachim

Same issue here, was fixed before in https://github.com/WordPress/gutenberg/issues/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.

ninetyninew avatar Apr 05 '21 13:04 ninetyninew

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 avatar May 31 '21 08:05 Mamaduka

PR is ready for testing #32364.

Mamaduka avatar Jun 01 '21 10:06 Mamaduka

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.

kmadhak avatar Jun 15 '21 12:06 kmadhak

Hi, @kmadhak

The PR is ready and waiting for a review.

Mamaduka avatar Jun 15 '21 12:06 Mamaduka