Skip to content

Images: Height gets ignored #52824

Closed
Closed

Description

@hanneslsm

Description

Images width a defined height will not correctly displayed on the front end.

Block Markup

<!-- wp:group {"style":{"spacing":{"padding":{"top":"0","bottom":"0","left":"0","right":"0"}}},"backgroundColor":"neutral-20","layout":{"type":"default"}} -->
<div class="wp-block-group has-neutral-20-background-color has-background" style="padding-top:0;padding-right:0;padding-bottom:0;padding-left:0"><!-- wp:group {"style":{"spacing":{"padding":{"right":"clamp(16px,6vw,96px)","left":"clamp(16px,6vw,96px)","top":"var:preset|spacing|v-padding-xl","bottom":"var:preset|spacing|v-padding-xl"}}},"backgroundColor":"neutral-20","layout":{"type":"default"}} -->
<div class="wp-block-group has-neutral-20-background-color has-background" style="padding-top:var(--wp--preset--spacing--v-padding-xl);padding-right:clamp(16px,6vw,96px);padding-bottom:var(--wp--preset--spacing--v-padding-xl);padding-left:clamp(16px,6vw,96px)"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:group {"align":"wide","layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|xs"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:heading {"level":1,"fontSize":"display-sm"} -->
<h1 class="wp-block-heading has-display-sm-font-size">The easiest way to build beautiful websites with Gutenberg</h1>
<!-- /wp:heading -->

<!-- wp:paragraph {"fontSize":"heading-6"} -->
<p class="has-heading-6-font-size">Simple and clean templates for Wordpress Gutenberg. <br>With hundreds of patterns, Figma files and everything else digital teams needs.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"primary-90"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-primary-90-background-color has-background wp-element-button">Learn more!</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:spacer {"style":{"layout":{"flexSize":null,"selfStretch":"fill"}}} -->
<div aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|xxs"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:image {"id":445,"width":56,"aspectRatio":"1","scale":"cover","sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
<figure class="wp-block-image size-large is-resized is-style-rounded"><img src="http://prolooks.local/wp-content/uploads/2023/07/image-683x1024.jpeg" alt="" class="wp-image-445" style="aspect-ratio:1;object-fit:cover;width:56px" width="56"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":402,"width":56,"aspectRatio":"1","scale":"cover","sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
<figure class="wp-block-image size-large is-resized is-style-rounded"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-IKEX2B0tJJY-unsplash-683x1024.jpg" alt="" class="wp-image-402" style="aspect-ratio:1;object-fit:cover;width:56px" width="56"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":403,"width":56,"aspectRatio":"1","scale":"cover","sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
<figure class="wp-block-image size-large is-resized is-style-rounded"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-UlxfzEEN3HU-unsplash-683x1024.jpg" alt="" class="wp-image-403" style="aspect-ratio:1;object-fit:cover;width:56px" width="56"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":401,"width":56,"aspectRatio":"1","scale":"cover","sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
<figure class="wp-block-image size-large is-resized is-style-rounded"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-gPVzwSi5mws-unsplash-1024x683.jpg" alt="" class="wp-image-401" style="aspect-ratio:1;object-fit:cover;width:56px" width="56"/></figure>
<!-- /wp:image --></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"typography":{"lineHeight":"1","fontStyle":"normal","fontWeight":"600"}},"fontSize":"heading-3"} -->
<p class="has-heading-3-font-size" style="font-style:normal;font-weight:600;line-height:1">200+</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"fontSize":"paragraph-sm"} -->
<p class="has-paragraph-sm-font-size">happy customers</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"typography":{"lineHeight":"1","fontStyle":"normal","fontWeight":"600"}},"fontSize":"heading-3"} -->
<p class="has-heading-3-font-size" style="font-style:normal;font-weight:600;line-height:1">15+</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"fontSize":"paragraph-sm"} -->
<p class="has-paragraph-sm-font-size">years experience</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:gallery {"columns":2,"linkTo":"none"} -->
<figure class="wp-block-gallery has-nested-images columns-2 is-cropped"><!-- wp:image {"id":445,"height":250,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
<figure class="wp-block-image size-large is-resized is-style-default"><img src="http://prolooks.local/wp-content/uploads/2023/07/image-683x1024.jpeg" alt="" class="wp-image-445" style="height:250px" height="250"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":403,"height":250,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
<figure class="wp-block-image size-large is-resized is-style-default"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-UlxfzEEN3HU-unsplash-683x1024.jpg" alt="" class="wp-image-403" style="height:250px" height="250"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":402,"height":250,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
<figure class="wp-block-image size-large is-resized is-style-default"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-IKEX2B0tJJY-unsplash-683x1024.jpg" alt="" class="wp-image-402" style="height:250px" height="250"/></figure>
<!-- /wp:image -->

<!-- wp:image {"id":401,"height":250,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
<figure class="wp-block-image size-large is-resized is-style-default"><img src="http://prolooks.local/wp-content/uploads/2023/07/martin-martz-gPVzwSi5mws-unsplash-1024x683.jpg" alt="" class="wp-image-401" style="height:250px" height="250"/></figure>
<!-- /wp:image --></figure>
<!-- /wp:gallery --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

Step-by-step reproduction instructions

  1. Put images in a gallery
  2. Set a height
  3. See how it looks correct on the editor, not so on the front end though

Screenshots, screen recording, code snippet

Screen.Recording.2023-07-21.at.10.03.49.mp4

Environment info

  • WP 6.2.2
  • GB 16.2.1
  • Custom theme

Please confirm that you have searched existing issues in the repo.

No

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    Needs TestingNeeds further testing to be confirmed.
    [Block] GalleryAffects the Gallery Block - used to display groups of images
    on Jul 26, 2023
  2. stacimc commented on Aug 2, 2023

    @stacimc
    Contributor

    I was able to reproduce on GB trunk with Twenty Twenty Three:

    Editor Frontend
    Screenshot 2023-08-02 at 12 29 18 PM Screenshot 2023-08-02 at 12 33 52 PM

    With 500px height applied to all images. The style is being applied to the <img> tag, but something about the flexing of the <figure> wrapper seems to break it. Width settings worked correctly in my tests.

  3. hanneslsm commented on Aug 3, 2023

    @hanneslsm
    Author

    @ajlende @scruffian you both are working on the image block, right? Does this overlap and is considered what is showed in the issue here?

  4. t-hamano commented on Aug 3, 2023

    @t-hamano
    Contributor

    My understanding is that being able to set the height of an image block inside a gallery block is not what was intended. In WordPress 6.2, height cannot be set.

    #53181 attempts to fix this issue.

    image

  5. github-actions commented on Sep 3, 2023

    @github-actions

    Hi,
    This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
    Thanks for helping out.

  6. added
    [Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.
    on Sep 3, 2023
  7. t-hamano commented on Sep 3, 2023

    @t-hamano
    Contributor

    With #53181, the Dimensions panel is no longer displayed when an image is not resizable. This PR has been backported to WP6.3.1 and the width and height of images in the gallery block can no longer be changed.

    I would like to close this issue as I believe this behavior is what was originally intended and the issue has been resolved.

  8. removed
    [Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.
    on Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TestingNeeds further testing to be confirmed.[Block] GalleryAffects the Gallery Block - used to display groups of images[Block] ImageAffects the Image Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions