X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..46588ee871246a923d972538dbc93b26f4fda932:/wp-includes/class-wp-image-editor-imagick.php diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 4ebed4ba..a70bebda 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -15,10 +15,12 @@ * @uses WP_Image_Editor Extends class */ class WP_Image_Editor_Imagick extends WP_Image_Editor { + /** + * @var Imagick + */ + protected $image; // Imagick Object - protected $image = null; // Imagick Object - - function __destruct() { + public function __destruct() { if ( $this->image instanceof Imagick ) { // we don't need the original in memory anymore $this->image->clear(); @@ -140,10 +142,11 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { } $updated_size = $this->update_size(); - if ( is_wp_error( $updated_size ) ) - return $updated_size; + if ( is_wp_error( $updated_size ) ) { + return $updated_size; + } - return $this->set_quality( $this->quality ); + return $this->set_quality(); } /** @@ -160,7 +163,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { if ( is_wp_error( $quality_result ) ) { return $quality_result; } else { - $quality = $this->quality; + $quality = $this->get_quality(); } try { @@ -187,6 +190,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * * @param int $width * @param int $height + * + * @return true|WP_Error */ protected function update_size( $width = null, $height = null ) { $size = null; @@ -296,8 +301,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { } $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); + $duplicate = ( ( $orig_size['width'] == $size_data['width'] ) && ( $orig_size['height'] == $size_data['height'] ) ); - if( ! is_wp_error( $resize_result ) ) { + if ( ! is_wp_error( $resize_result ) && ! $duplicate ) { $resized = $this->_save( $this->image ); $this->image->clear(); @@ -324,7 +330,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * @since 3.5.0 * @access public * - * @param string|int $src The source file or Attachment ID. * @param int $src_x The start x position to crop from. * @param int $src_y The start y position to crop from. * @param int $src_w The width to crop.