WordPress.org

Make WordPress Core

Opened 15 months ago

Last modified 10 months ago

#23398 new defect (bug)

Media Gallery - Clicking "Restore Original Image" in "Scale Image" pane loses 'Thumbnail Settings' pane.

Reported by: gr33nman Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords: has-patch 2nd-opinion dev-feedback needs-testing
Focuses: Cc:

Description

Reproduce the problem thusly:

Click "Edit image" in the "Edit Media" interface for any image.

/wp-admin/post.php?post=1119&action=edit

Scale the image a couple times in the 'Scale Image' pane. Update.

Click "Restore Original Image" in the 'Scale Image' pane.

Try to crop just the thumbnail.

The 'Thumbnail Settings' Pane is gone.

The image has to be deleted and re-uploaded to gain thumbnail control once again.

Attachments (1)

image-edit.diff (296 bytes) - added by mboynes 14 months ago.
Patch for restore image bug #23398

Download all attachments as: .zip

Change History (6)

comment:1 gr33nman15 months ago

  • Summary changed from Media Gallery - Clicking "Restore Original Image" in "Scale Image" pane loses thumbnail editing pane. to Media Gallery - Clicking "Restore Original Image" in "Scale Image" pane loses 'Thumbnail Settings' pane.

comment:2 markoheijnen15 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.6
  • Version changed from 3.5.1 to 3.4

Only tested in 3.4 and can reproduce it there as well.

mboynes14 months ago

Patch for restore image bug #23398

comment:3 mboynes14 months ago

  • Cc mboynes added
  • Keywords has-patch 2nd-opinion dev-feedback added; needs-patch removed

I added a patch that resolves this, however I'm uncertain of any potential repercussions.

The issue here is that wp_restore_image is only setting meta for image sizes that have been edited (and thus have an entry in the _wp_attachment_backup_sizes postmeta for the image). For instance, if you crop the image and apply to all image sizes, then go through the steps to reproduce this error, you won't replicate it. If you only scale the image, the only image size you edit is the original, therefore the only backup meta data is for the original and wp_restore_image unsets the other sizes in _wp_attachment_metadata.

As far as I can tell, unsetting the non-edited sizes is unnecessary. I cannot think of a use-case scenario where this would need to be done.

This patch will only fix this issue for images that are scaled after applying the patch. Images scaled prior to applying the patch will need to have their other image sizes regenerated via a plugin like Regenerate Thumbnails.

comment:4 mboynes14 months ago

  • Keywords needs-testing added

comment:5 markjaquith10 months ago

  • Milestone changed from 3.6 to Future Release

Would like a better explanation of what is going on to feel confident about the way to fix it.

Note: See TracTickets for help on using tickets.