X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FBitmap.php;h=49596874154e9d1b29415d097545e6ede0fb3939;hb=075b90235e86de663c000db2c90253509bb97375;hp=9f7a09cc85c218834b2e9dc63f73b10e077fedbb;hpb=e0b187264cf2df355116af119fab18cdf7ebf19d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 9f7a09cc85..4959687415 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -99,17 +99,6 @@ class BitmapHandler extends ImageHandler { return array( $width, $height ); } - /** - * 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 @@ -179,6 +168,13 @@ class BitmapHandler extends ImageHandler { # Transform functions and binaries need a FS source file $scalerParams['srcPath'] = $image->getLocalRefPath(); + if ( $scalerParams['srcPath'] === false ) { // Failed to get local copy + wfDebugLog( 'thumbnail', + sprintf( 'Thumbnail failed on %s: could not get local copy of "%s"', + wfHostname(), $image->getName() ) ); + return new MediaTransformError( 'thumbnail_error', + $scalerParams['clientWidth'], $scalerParams['clientHeight'] ); + } # Try a hook $mto = null; @@ -357,12 +353,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 ) { @@ -472,7 +468,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,25 +708,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) * @@ -774,11 +751,11 @@ class BitmapHandler extends ImageHandler { $cmd = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " . 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 );