summaryrefslogtreecommitdiff
path: root/includes/media/Bitmap.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/media/Bitmap.php')
-rw-r--r--includes/media/Bitmap.php47
1 files changed, 9 insertions, 38 deletions
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index e2dc68b2..e2444a11 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -100,17 +100,6 @@ class BitmapHandler extends ImageHandler {
}
/**
- * Function that returns the number of pixels to be thumbnailed.
- * Intended for animated GIFs to multiply by the number of frames.
- *
- * @param File $image
- * @return int
- */
- function getImageArea( $image ) {
- return $image->getWidth() * $image->getHeight();
- }
-
- /**
* @param $image File
* @param $dstPath
* @param $dstUrl
@@ -131,7 +120,7 @@ class BitmapHandler extends ImageHandler {
# The size of the image on the page
'clientWidth' => $params['width'],
'clientHeight' => $params['height'],
- # Comment as will be added to the EXIF of the thumbnail
+ # Comment as will be added to the Exif of the thumbnail
'comment' => isset( $params['descriptionUrl'] ) ?
"File source: {$params['descriptionUrl']}" : '',
# Properties of the original image
@@ -357,12 +346,12 @@ class BitmapHandler extends ImageHandler {
" -depth 8 $sharpen " .
" -rotate -$rotation " .
" {$animation_post} " .
- wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) ) . " 2>&1";
+ wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) );
wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
wfProfileIn( 'convert' );
$retval = 0;
- $err = wfShellExec( $cmd, $retval, $env );
+ $err = wfShellExecWithStderr( $cmd, $retval, $env );
wfProfileOut( 'convert' );
if ( $retval !== 0 ) {
@@ -398,7 +387,7 @@ class BitmapHandler extends ImageHandler {
$im->sharpenImage( $radius, $sigma );
}
$im->setCompressionQuality( 80 );
- } elseif( $params['mimeType'] == 'image/png' ) {
+ } elseif ( $params['mimeType'] == 'image/png' ) {
$im->setCompressionQuality( 95 );
} elseif ( $params['mimeType'] == 'image/gif' ) {
if ( $this->getImageArea( $image ) > $wgMaxAnimatedGifArea ) {
@@ -472,7 +461,7 @@ class BitmapHandler extends ImageHandler {
wfDebug( __METHOD__ . ": Running custom convert command $cmd\n" );
wfProfileIn( 'convert' );
$retval = 0;
- $err = wfShellExec( $cmd, $retval );
+ $err = wfShellExecWithStderr( $cmd, $retval );
wfProfileOut( 'convert' );
if ( $retval !== 0 ) {
@@ -712,24 +701,6 @@ class BitmapHandler extends ImageHandler {
imagejpeg( $dst_image, $thumbPath, 95 );
}
- /**
- * On supporting image formats, try to read out the low-level orientation
- * of the file and return the angle that the file needs to be rotated to
- * be viewed.
- *
- * This information is only useful when manipulating the original file;
- * the width and height we normally work with is logical, and will match
- * any produced output views.
- *
- * The base BitmapHandler doesn't understand any metadata formats, so this
- * is left up to child classes to implement.
- *
- * @param $file File
- * @return int 0, 90, 180 or 270
- */
- public function getRotation( $file ) {
- return 0;
- }
/**
* Returns whether the current scaler supports rotation (im and gd do)
@@ -765,20 +736,20 @@ class BitmapHandler extends ImageHandler {
public function rotate( $file, $params ) {
global $wgImageMagickConvertCommand;
- $rotation = ( $params[ 'rotation' ] + $this->getRotation( $file ) ) % 360;
+ $rotation = ( $params['rotation'] + $this->getRotation( $file ) ) % 360;
$scene = false;
$scaler = self::getScalerType( null, false );
switch ( $scaler ) {
case 'im':
$cmd = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " .
- wfEscapeShellArg( $this->escapeMagickInput( $params[ 'srcPath' ], $scene ) ) .
+ wfEscapeShellArg( $this->escapeMagickInput( $params['srcPath'], $scene ) ) .
" -rotate -$rotation " .
- wfEscapeShellArg( $this->escapeMagickOutput( $params[ 'dstPath' ] ) ) . " 2>&1";
+ wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) );
wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
wfProfileIn( 'convert' );
$retval = 0;
- $err = wfShellExec( $cmd, $retval, $env );
+ $err = wfShellExecWithStderr( $cmd, $retval, $env );
wfProfileOut( 'convert' );
if ( $retval !== 0 ) {
$this->logErrorForExternalProcess( $retval, $err, $cmd );