Make WordPress Core

Opened 12 years ago

Last modified 6 years ago

#23398 new defect (bug)

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

Reported by: gr33nman's profile gr33nman Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords: has-patch dev-feedback needs-testing
Focuses: administration 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 12 years ago.
Patch for restore image bug #23398

Download all attachments as: .zip

Change History (8)

#1 @gr33nman
12 years 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.

#2 @markoheijnen
12 years 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.

@mboynes
12 years ago

Patch for restore image bug #23398

#3 @mboynes
12 years 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.

#4 @mboynes
12 years ago

  • Keywords needs-testing added

#5 @markjaquith
11 years 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.

#6 @chriscct7
9 years ago

  • Focuses administration added
  • Keywords 2nd-opinion removed

#7 @lkraav
9 years ago

Yep, same on 4.4.2 and this definitely made for a wacky user experience. No way to understand why suddenly can't get back to the starting point, until you notice the uuid added to the original image's name, meaning it's not the original any longer.

"Restore original image" therefore lies.

Is there someone currently hacking the media library and is in enough of a flow to say something meaningful about the next step options here?

Note: See TracTickets for help on using tickets.