From: Platonides Date: Fri, 8 Mar 2013 12:07:32 +0000 (+0100) Subject: Fixes for e288e4036 X-Git-Tag: 1.31.0-rc.0~20394^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=d1bc1b968b137315ca7806ddaa73776c97138ddf;p=lhc%2Fweb%2Fwiklou.git Fixes for e288e4036 Changed static calls to instance functions. Make BitmapHandler::rotate() non-static. We don't have a Bitmap class. It should have been falling back to BitmapHandler class. (JpegHandler ← ExifBitmapHandler ← BitmapHandler) Change-Id: I17be410456b00cef2ded8d6e2282ae0de4785695 --- diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 3815d41070..80a8078b8c 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -134,7 +134,7 @@ class ApiImageRotate extends ApiBase { */ private function getPageSet() { if ( $this->mPageSet === null ) { - $this->mPageSet = new ApiPageSet( $this, 0, NS_FILE); + $this->mPageSet = new ApiPageSet( $this, 0, NS_FILE ); } return $this->mPageSet; } diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 0ad862d8dc..c31c46bedc 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -634,7 +634,7 @@ class BitmapHandler extends ImageHandler { # Escape glob chars $path = preg_replace( '/[*?\[\]{}]/', '\\\\\0', $path ); - return self::escapeMagickPath( $path, $scene ); + return $this->escapeMagickPath( $path, $scene ); } /** @@ -644,7 +644,7 @@ class BitmapHandler extends ImageHandler { */ function escapeMagickOutput( $path, $scene = false ) { $path = str_replace( '%', '%%', $path ); - return self::escapeMagickPath( $path, $scene ); + return $this->escapeMagickPath( $path, $scene ); } /** @@ -762,26 +762,26 @@ class BitmapHandler extends ImageHandler { * @since 1.21 * @return bool */ - public static function rotate( $file, $params ) { + public function rotate( $file, $params ) { global $wgImageMagickConvertCommand; - $rotation = ( $params[ 'rotation' ] + self::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( self::escapeMagickInput( $params[ 'srcPath' ], $scene ) ) . + wfEscapeShellArg( $this->escapeMagickInput( $params[ 'srcPath' ], $scene ) ) . " -rotate -$rotation " . - wfEscapeShellArg( self::escapeMagickOutput( $params[ 'dstPath' ] ) ) . " 2>&1"; + wfEscapeShellArg( $this->escapeMagickOutput( $params[ 'dstPath' ] ) ) . " 2>&1"; wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" ); wfProfileIn( 'convert' ); $retval = 0; $err = wfShellExec( $cmd, $retval, $env ); wfProfileOut( 'convert' ); if ( $retval !== 0 ) { - self::logErrorForExternalProcess( $retval, $err, $cmd ); + $this->logErrorForExternalProcess( $retval, $err, $cmd ); return new MediaTransformError( 'thumbnail_error', 0, 0, $err ); } return false; diff --git a/includes/media/ExifBitmap.php b/includes/media/ExifBitmap.php index 1a761f3a70..1671ab2584 100644 --- a/includes/media/ExifBitmap.php +++ b/includes/media/ExifBitmap.php @@ -190,7 +190,7 @@ class ExifBitmapHandler extends BitmapHandler { } $data = $file->getMetadata(); - return self::getRotationForExif( $data ); + return $this->getRotationForExif( $data ); } /** diff --git a/includes/media/Jpeg.php b/includes/media/Jpeg.php index cd6f18c0df..355cab31b4 100644 --- a/includes/media/Jpeg.php +++ b/includes/media/Jpeg.php @@ -66,10 +66,10 @@ class JpegHandler extends ExifBitmapHandler { * @since 1.21 * @return bool */ - public static function rotate( $file, $params ) { + public function rotate( $file, $params ) { global $wgJpegTran; - $rotation = ( $params[ 'rotation' ] + self::getRotation( $file ) ) % 360; + $rotation = ( $params[ 'rotation' ] + $this->getRotation( $file ) ) % 360; if( $wgJpegTran && is_file( $wgJpegTran ) ){ $cmd = wfEscapeShellArg( $wgJpegTran ) . @@ -82,12 +82,12 @@ class JpegHandler extends ExifBitmapHandler { $err = wfShellExec( $cmd, $retval, $env ); wfProfileOut( 'jpegtran' ); if ( $retval !== 0 ) { - self::logErrorForExternalProcess( $retval, $err, $cmd ); + $this->logErrorForExternalProcess( $retval, $err, $cmd ); return new MediaTransformError( 'thumbnail_error', 0, 0, $err ); } return false; } else { - return Bitmap::rotate( $file, $params ); + return parent::rotate( $file, $params ); } }