$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(
}
}
- $rotation = $this->getRotation( $image );
+ $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image );
list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
$im->setImageBackgroundColor( new ImagickPixel( 'white' ) );
$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 );
# 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'];