Make WordPress Core

Ticket #37140: 37140.4.patch

File 37140.4.patch, 923 bytes (added by azaozz, 7 years ago)
  • src/wp-includes/class-wp-image-editor-imagick.php

     
    175175                        return $updated_size;
    176176                }
    177177
     178                if ( 'image/jpeg' === $this->mime_type ) {
     179                        $this->reset_orientation();
     180                }
     181
    178182                return $this->set_quality();
    179183        }
    180184
     
    761765                }
    762766        }
    763767
     768        /**
     769         * Reset the exif image orientation data.
     770         *
     771         * @since 4.7.3
     772         * @access protected
     773         *
     774         * @return true|WP_Error True if successful or WP_Error on failure.
     775         */
     776        protected function reset_orientation() {
     777                try {
     778                        $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT );
     779                }
     780                catch ( Exception $e ) {
     781                        return new WP_Error( 'image_reset_orientation_error', $e->getMessage() );
     782                }
     783
     784                return true;
     785        }
     786
    764787}