Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30167 closed defect (bug) (fixed)

Restoring an image when IMAGE_EDIT_OVERWRITE is true results in 'Cannot save image metadata.'

Reported by: tiqbiz's profile tiqbiz Owned by: azaozz's profile azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords: has-patch
Focuses: administration Cc:

Description

When restoring an image (after resizing it etc.), if IMAGE_EDIT_OVERWRITE is set to true then the following condition fails (/wp-admin/includes/image-edit.php, line 622):

if ( !wp_update_attachment_metadata($post_id, $meta) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {

This is because _wp_attachment_backup_sizes is already the same as $backup_sizes (update_post_meta returns false if there is no update made).

Patch attached, not 100% sure of the coding style though.

Attachments (1)

image-edit.php.patch (759 bytes) - added by tiqbiz 10 years ago.

Download all attachments as: .zip

Change History (5)

#1 @tiqbiz
10 years ago

  • Keywords has-patch added

#2 @hew
10 years ago

Probably related one way or another: #30394

#3 @azaozz
10 years ago

  • Milestone changed from Awaiting Review to 4.2

@tiqbiz thanks for the patch. I'll tweak the coding style a bit :)

Can reproduce. Only the error message is wrong. The attachment meta is updated properly or not updated if it hasn't changed.

#4 @azaozz
10 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31070:

Image file editor: fix a wrong error message when restoring an edited image and IMAGE_EDIT_OVERWRITE is set. Props tiqbiz, fixes #30167.

Note: See TracTickets for help on using tickets.