]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-image-editor-imagick.php
WordPress 4.2.4-scripts
[autoinstalls/wordpress.git] / wp-includes / class-wp-image-editor-imagick.php
index 8bd6e38861c2ceba374bef8417462fc8ddc83e4c..a70bebdaebdacf0e29441f694185ad7eddd2c705 100644 (file)
  * @uses WP_Image_Editor Extends class
  */
 class WP_Image_Editor_Imagick extends WP_Image_Editor {
-
-       protected $image = null; // Imagick Object
+       /**
+        * @var Imagick
+        */
+       protected $image; // Imagick Object
 
        public function __destruct() {
                if ( $this->image instanceof Imagick ) {
@@ -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 true;
+               return $this->set_quality();
        }
 
        /**
@@ -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.