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

Image Block: When replacing a resized image by another image, the image proportions are preserved inside the editor but not on the front-end (WP 5.5 beta2) #23985

Closed
dianeco opened this issue Jul 16, 2020 · 4 comments · Fixed by #29919
Assignees
Labels
[Block] Image Affects the Image Block Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@dianeco
Copy link

dianeco commented Jul 16, 2020

To reproduce

  1. Inside the editor, insert an image.
  2. Resize the image to a smaller size using the resize handles.
  3. Replace the image by another one.
  4. Observe that visually the new image is distorted and has the same proportions as the replaced one. If you preview the front-end (or if you switch back and forth between the code editor and the visual editor), you’ll see that the image has, in reality, its own dimensions.

resized-image-replace

Tested using WordPress 5.5 beta 2 and WP 5.4.2 + Gutenberg 8.5.1.
The bug happens on Chrome, Firefox and Edge on both Windows and Mac.
It's working fine on Safari.

@annezazu annezazu added [Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended labels Aug 1, 2020
@annezazu
Copy link
Contributor

annezazu commented Aug 1, 2020

Thanks so much for reporting this @dianeco! Noting that I could replicate this with WordPress 5.5 RC and Gutenberg 8.6.1

@paaljoachim
Copy link
Contributor

paaljoachim commented Jan 23, 2021

I was also able to replace this error using Twenty Twenty One, WordPress 5.6 and Gutenberg plugin version 9.8.
(Tested with Safari.)

Isabel @tellthemachines I see this was added to WP 5.6.x Must Haves. Should we move this to the new project board for 5.7 ? Pinging Robert @noisysocks as well.

At the moment we have a lot of different Image block bugs. Hopefully many of these can be fixed for 5.7.

@noisysocks noisysocks added the Needs Dev Ready for, and needs developer efforts label Feb 4, 2021
@Mamaduka
Copy link
Member

Currently, we're resetting image dimensions attributes when changing to a different image. See #16125.

I think the ResizableBox component should also reflect this reset. It's ignored for some reason now.

Happy to work on this issue.

@paaljoachim
Copy link
Contributor

Thanks @Mamaduka George!
I went ahead and assigned the issue to you.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 17, 2021
Mamaduka added a commit to Mamaduka/gutenberg that referenced this issue Mar 26, 2021
…eight

When changing to a different image, we reset dimension attributes, including size props for the resizable box. But this doesn't automatically reset dimensions in the resizable box state, which is used for inline styles. So we have to do it manually.

See WordPress#23985.
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 Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants