Opened 3 months ago

Last modified 3 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:
Priority: normal Milestone: 3.6
Component: Media Version: 3.4
Severity: normal Keywords: has-patch 2nd-opinion dev-feedback needs-testing
Cc: mboynes

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 3 months ago.
Patch for restore image bug #23398

Download all attachments as: .zip

Change History (5)

  • 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.
  • 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.

Patch for restore image bug #23398

  • 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.

  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.