Fixed spacing
[lhc/web/wiklou.git] / includes / media / ImageHandler.php
index 419afee..b6586d0 100644 (file)
@@ -58,7 +58,7 @@ abstract class ImageHandler extends MediaHandler {
                } elseif ( isset( $params['width'] ) ) {
                        $width = $params['width'];
                } else {
-                       throw new MWException( 'No width specified to '.__METHOD__ );
+                       throw new MWException( 'No width specified to ' . __METHOD__ );
                }
                # Removed for ProofreadPage
                #$width = intval( $width );
@@ -92,7 +92,7 @@ abstract class ImageHandler extends MediaHandler {
 
                if ( !isset( $params['page'] ) ) {
                        $params['page'] = 1;
-               } else  {
+               } else {
                        if ( $params['page'] > $image->pageCount() ) {
                                $params['page'] = $image->pageCount();
                        }
@@ -160,7 +160,7 @@ abstract class ImageHandler extends MediaHandler {
                $width = intval( $width );
 
                # Sanity check $width
-               if( $width <= 0) {
+               if ( $width <= 0 ) {
                        wfDebug( __METHOD__ . ": Invalid destination width: $width\n" );
                        return false;
                }
@@ -187,9 +187,9 @@ abstract class ImageHandler extends MediaHandler {
                if ( !$this->normaliseParams( $image, $params ) ) {
                        return false;
                }
-               $url = $script . '&' . wfArrayToCgi( $this->getScriptParams( $params ) );
+               $url = wfAppendQuery( $script, $this->getScriptParams( $params ) );
 
-               if( $image->mustRender() || $params['width'] < $image->getWidth() ) {
+               if ( $image->mustRender() || $params['width'] < $image->getWidth() ) {
                        return new ThumbnailImage( $image, $url, false, $params );
                }
        }
@@ -200,6 +200,18 @@ abstract class ImageHandler extends MediaHandler {
                wfRestoreWarnings();
                return $gis;
        }
+       /**
+        * Function that returns the number of pixels to be thumbnailed.
+        * Intended for animated GIFs to multiply by the number of frames.
+        *
+        * If the file doesn't support a notion of "area" return 0.
+        *
+        * @param File $image
+        * @return int
+        */
+       function getImageArea( $image ) {
+               return $image->getWidth() * $image->getHeight();
+       }
 
        /**
         * @param $file File