Make WordPress Core

Ticket #37140: 37140-1.3.diff

File 37140-1.3.diff, 860 bytes (added by mikeschroder, 7 years ago)

feature check before orientation set

  • src/wp-includes/class-wp-image-editor-imagick.php

    diff --git src/wp-includes/class-wp-image-editor-imagick.php src/wp-includes/class-wp-image-editor-imagick.php
    index 34dd539..3589cc2 100644
    class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    550550                        $this->image->rotateImage( new ImagickPixel('none'), 360-$angle );
    551551
    552552                        // Normalise Exif orientation data so that display is consistent across devices.
    553                         $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT );
     553                        if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) {
     554                                $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT );
     555                        }
    554556
    555557                        // Since this changes the dimensions of the image, update the size.
    556558                        $result = $this->update_size();