Skip to content

Image: Include the height and width within transformations. #38528

Closed as duplicate

Description

@codebymikey

What problem does this address?

When pasting certain image HTML, Gutenberg should attempt to pick up the height and width of the img. Prioritizing the style e.g. style="height: 100px; 200px;", then falling back to the width and height attributes.

This ensures that the output is still visually similar to the source HTML just in case the original image source is much bigger than the specified height and width.

Example markup to pick up during the transformation:

<img src="/large-image-2.jpg" alt="Large image 1" width="300" height="500" style="width: 150px; height: 250px" />
<img src="/large-image-2.jpg" alt="Large image 2" width="300" height="500" />

What is your proposed solution?

Update the image block's raw transformation to include the width and height attributes.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions