Merge "Improve behavior of IP::toUnsigned on Windows"
[lhc/web/wiklou.git] / includes / media / Jpeg.php
index cd6f18c..1feb378 100644 (file)
@@ -32,7 +32,7 @@
  */
 class JpegHandler extends ExifBitmapHandler {
 
-       function getMetadata ( $image, $filename ) {
+       function getMetadata( $image, $filename ) {
                try {
                        $meta = BitmapMetadataHandler::Jpeg( $filename );
                        if ( !is_array( $meta ) ) {
@@ -61,33 +61,33 @@ class JpegHandler extends ExifBitmapHandler {
 
        /**
         * @param $file File
-        * @param $params array Rotate parameters.
+        * @param array $params Rotate parameters.
         *      'rotation' clockwise rotation in degrees, allowed are multiples of 90
         * @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 ) ){
+               if ( $wgJpegTran && is_file( $wgJpegTran ) ) {
                        $cmd = wfEscapeShellArg( $wgJpegTran ) .
                                " -rotate " . wfEscapeShellArg( $rotation ) .
-                               " -outfile " . wfEscapeShellArg( $params[ 'dstPath' ] ) .
-                               " " . wfEscapeShellArg( $params[ 'srcPath' ] ) .  " 2>&1";
-                               wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" );
-                               wfProfileIn( 'jpegtran' );
-                               $retval = 0;
-                               $err = wfShellExec( $cmd, $retval, $env );
-                               wfProfileOut( 'jpegtran' );
+                               " -outfile " . wfEscapeShellArg( $params['dstPath'] ) .
+                               " " . wfEscapeShellArg( $params['srcPath'] ) . " 2>&1";
+                       wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" );
+                       wfProfileIn( 'jpegtran' );
+                       $retval = 0;
+                       $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 );
                }
        }