if ( $srcWidth * $srcHeight > $wgMaxImageArea
&& !( $image->getMimeType() == 'image/jpeg'
- && self::getScalerType( false, false ) == 'im' )
+ && self::getScalerType( false, false ) == 'im' )
) {
# Only ImageMagick can efficiently downsize jpg images without loading
# the entire file in memory
wfHostname(), $image->getName() ) );
return new MediaTransformError( 'thumbnail_error',
- $scalerParams['clientWidth'], $scalerParams['clientHeight'] );
+ $scalerParams['clientWidth'], $scalerParams['clientHeight'],
+ wfMessage( 'filemissing' )->text()
+ );
}
# Try a hook
} elseif ( $removed ) {
# Thumbnail was zero-byte and had to be removed
return new MediaTransformError( 'thumbnail_error',
- $scalerParams['clientWidth'], $scalerParams['clientHeight'] );
+ $scalerParams['clientWidth'], $scalerParams['clientHeight'],
+ wfMessage( 'unknown-error' )->text()
+ );
} elseif ( $mto ) {
return $mto;
} else {
if ( $retval !== 0 ) {
$this->logErrorForExternalProcess( $retval, $err, $cmd );
- return $this->getMediaTransformError( $params, $err );
+ return $this->getMediaTransformError( $params, "$err\nError code: $retval" );
}
return false; # No error
}
}
+ /**
+ * @see $wgEnableAutoRotation
+ * @return bool Whether auto rotation is enabled
+ */
+ public static function autoRotateEnabled() {
+ global $wgEnableAutoRotation;
+
+ if ( $wgEnableAutoRotation === null ) {
+ // Only enable auto-rotation when the bitmap handler can rotate
+ $wgEnableAutoRotation = BitmapHandler::canRotate();
+ }
+
+ return $wgEnableAutoRotation;
+ }
+
/**
* @param File $file
* @param array $params Rotate parameters.