Media: Reset Exif orientation after rotate in WP_Image_Editor_Imagick.

Due to inconsistencies in the way browsers handle Exif orientation data,
if a user manually rotates an image within WordPress, set the Exif orientation to
the default (1) so that the image displays with the same rotation/flip in every browser.

Props sanchothefat, triplejumper12, joemcgill, azaozz, markoheijnen, mikeschroder.
See #14459.
Fixes #37140.

git-svn-id: https://develop.svn.wordpress.org/trunk@40123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Schroder
2017-02-25 05:25:40 +00:00
parent e5d5f1058e
commit cfe271d254
3 changed files with 33 additions and 0 deletions
@@ -549,6 +549,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
try {
$this->image->rotateImage( new ImagickPixel('none'), 360-$angle );
// Normalise Exif orientation data so that display is consistent across devices.
$this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT );
// Since this changes the dimensions of the image, update the size.
$result = $this->update_size();
if ( is_wp_error( $result ) )