From 21767e446e7d03d1a4370c119d0ab12d0bce1174 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 28 Sep 2013 06:37:11 +0000 Subject: [PATCH] Fix non-square rotations when using the Imagick image editor. props DH-Shredder. fixes #22663. Built from https://develop.svn.wordpress.org/trunk@25636 git-svn-id: http://core.svn.wordpress.org/trunk@25553 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index f803943a4b..436fdec782 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -352,11 +352,18 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { */ try { $this->image->rotateImage( new ImagickPixel('none'), 360-$angle ); + + // Since this changes the dimensions of the image, update the size. + $result = $this->update_size(); + if ( is_wp_error( $result ) ) + return $result; + + $this->image->setImagePage( $this->size['width'], $this->size['height'], 0, 0 ); } catch ( Exception $e ) { return new WP_Error( 'image_rotate_error', $e->getMessage() ); } - return $this->update_size(); + return true; } /**