Gilles has uploaded a new change for review. https://gerrit.wikimedia.org/r/174453
Change subject: Don't re-apply EXIF rotation to chained thumbnails ...................................................................... Don't re-apply EXIF rotation to chained thumbnails Change-Id: I2f0674e4aea508ad7e00b7742a9d47bd0659e399 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/600 Bug: 67525 Bug: 73352 --- M includes/media/Bitmap.php M includes/media/TransformationalImageHandler.php 2 files changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/53/174453/1 diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index e81b37d..0292af8 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -142,7 +142,7 @@ $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir; } - $rotation = $this->getRotation( $image ); + $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image ); list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); $cmd = call_user_func_array( 'wfEscapeShellArg', array_merge( @@ -223,7 +223,7 @@ } } - $rotation = $this->getRotation( $image ); + $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image ); list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); $im->setImageBackgroundColor( new ImagickPixel( 'white' ) ); @@ -344,7 +344,7 @@ $src_image = call_user_func( $loader, $params['srcPath'] ); - $rotation = function_exists( 'imagerotate' ) ? $this->getRotation( $image ) : 0; + $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ? $this->getRotation( $image ) : 0; list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); $dst_image = imagecreatetruecolor( $width, $height ); diff --git a/includes/media/TransformationalImageHandler.php b/includes/media/TransformationalImageHandler.php index 3e3be3d..b3ae296 100644 --- a/includes/media/TransformationalImageHandler.php +++ b/includes/media/TransformationalImageHandler.php @@ -216,6 +216,12 @@ # Transform functions and binaries need a FS source file $thumbnailSource = $this->getThumbnailSource( $image, $params ); + // If the source isn't the original, disable EXIF rotation because it's already been applied + if ( $scalerParams['srcWidth'] != $thumbnailSource['width'] + || $scalerParams['srcHeight'] != $thumbnailSource['height'] ) { + $scalerParams['disableRotation'] = true; + } + $scalerParams['srcPath'] = $thumbnailSource['path']; $scalerParams['srcWidth'] = $thumbnailSource['width']; $scalerParams['srcHeight'] = $thumbnailSource['height']; -- To view, visit https://gerrit.wikimedia.org/r/174453 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f0674e4aea508ad7e00b7742a9d47bd0659e399 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.25wmf8 Gerrit-Owner: Gilles <gdu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits