Changeset 46202 for trunk/src/wp-includes/class-wp-image-editor-imagick.php
- Timestamp:
- 09/20/2019 06:20:26 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r46088 r46202 567 567 $this->image->rotateImage( new ImagickPixel( 'none' ), 360 - $angle ); 568 568 569 // Normalise E xiforientation data so that display is consistent across devices.569 // Normalise EXIF orientation data so that display is consistent across devices. 570 570 if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { 571 571 $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); … … 603 603 $this->image->flopImage(); 604 604 } 605 606 // Normalise EXIF orientation data so that display is consistent across devices. 607 if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { 608 $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); 609 } 605 610 } catch ( Exception $e ) { 606 611 return new WP_Error( 'image_flip_error', $e->getMessage() ); 607 612 } 613 608 614 return true; 615 } 616 617 /** 618 * Check if a JPEG image has EXIF Orientation tag and rotate it if needed. 619 * 620 * As ImageMagick copies the EXIF data to the flipped/rotated image, proceed only 621 * if EXIF Orientation can be reset afterwards. 622 * 623 * @since 5.3.0 624 * 625 * @return bool|WP_Error True if the image was rotated. False if no EXIF data or if the image doesn't need rotation. 626 * WP_Error if error while rotating. 627 */ 628 public function maybe_exif_rotate() { 629 if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { 630 return parent::maybe_exif_rotate(); 631 } else { 632 return new WP_Error( 'write_exif_error', __( 'The image cannot be rotated because the embedded meta data cannot be updated.' ) ); 633 } 609 634 } 610 635
Note: See TracChangeset
for help on using the changeset viewer.