(Bug 41370) protect aginst content-less revisions
[lhc/web/wiklou.git] / includes / media / Bitmap.php
index 0f30c6f..ca9b636 100644 (file)
@@ -167,8 +167,11 @@ class BitmapHandler extends ImageHandler {
 
                if ( $flags & self::TRANSFORM_LATER ) {
                        wfDebug( __METHOD__ . ": Transforming later per flags.\n" );
-                       return new ThumbnailImage( $image, $dstUrl, $scalerParams['clientWidth'],
-                               $scalerParams['clientHeight'], false );
+                       $params = array(
+                               'width' => $scalerParams['clientWidth'],
+                               'height' => $scalerParams['clientHeight']
+                       );
+                       return new ThumbnailImage( $image, $dstUrl, false, $params );
                }
 
                # Try to make a target path for the thumbnail
@@ -220,8 +223,11 @@ class BitmapHandler extends ImageHandler {
                } elseif ( $mto ) {
                        return $mto;
                } else {
-                       return new ThumbnailImage( $image, $dstUrl, $scalerParams['clientWidth'],
-                               $scalerParams['clientHeight'], $dstPath );
+                       $params = array(
+                               'width' => $scalerParams['clientWidth'],
+                               'height' => $scalerParams['clientHeight']
+                       );
+                       return new ThumbnailImage( $image, $dstUrl, $dstPath, $params );
                }
        }
 
@@ -258,14 +264,17 @@ class BitmapHandler extends ImageHandler {
         * client side
         *
         * @param $image File File associated with this thumbnail
-        * @param $params array Array with scaler params
+        * @param $scalerParams array Array with scaler params
         * @return ThumbnailImage
         *
         * @todo fixme: no rotation support
         */
-       protected function getClientScalingThumbnailImage( $image, $params ) {
-               return new ThumbnailImage( $image, $image->getURL(),
-                       $params['clientWidth'], $params['clientHeight'], null );
+       protected function getClientScalingThumbnailImage( $image, $scalerParams ) {
+               $params = array(
+                       'width' => $scalerParams['clientWidth'],
+                       'height' => $scalerParams['clientHeight']
+               );
+               return new ThumbnailImage( $image, $image->getURL(), null, $params );
        }
 
        /**
@@ -524,7 +533,7 @@ class BitmapHandler extends ImageHandler {
                if ( !isset( $typemap[$params['mimeType']] ) ) {
                        $err = 'Image type not supported';
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_image-type' );
+                       $errMsg = wfMessage( 'thumbnail_image-type' )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
                list( $loader, $colorStyle, $saveType ) = $typemap[$params['mimeType']];
@@ -532,14 +541,14 @@ class BitmapHandler extends ImageHandler {
                if ( !function_exists( $loader ) ) {
                        $err = "Incomplete GD library configuration: missing function $loader";
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_gd-library', $loader );
+                       $errMsg = wfMessage( 'thumbnail_gd-library', $loader )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
                if ( !file_exists( $params['srcPath'] ) ) {
                        $err = "File seems to be missing: {$params['srcPath']}";
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_image-missing', $params['srcPath'] );
+                       $errMsg = wfMessage( 'thumbnail_image-missing', $params['srcPath'] )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
@@ -614,7 +623,8 @@ class BitmapHandler extends ImageHandler {
         * to filter down to users.
         *
         * @param $path string The file path
-        * @param $scene string The scene specification, or false if there is none
+        * @param bool|string $scene The scene specification, or false if there is none
+        * @throws MWException
         * @return string
         */
        function escapeMagickInput( $path, $scene = false ) {
@@ -645,7 +655,8 @@ class BitmapHandler extends ImageHandler {
         * helper function for escapeMagickInput() and escapeMagickOutput().
         *
         * @param $path string The file path
-        * @param $scene string The scene specification, or false if there is none
+        * @param bool|string $scene The scene specification, or false if there is none
+        * @throws MWException
         * @return string
         */
        protected function escapeMagickPath( $path, $scene = false ) {