diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
commit | 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch) | |
tree | af68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/media/ImageHandler.php | |
parent | af4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff) |
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/media/ImageHandler.php')
-rw-r--r-- | includes/media/ImageHandler.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/includes/media/ImageHandler.php b/includes/media/ImageHandler.php index 419afeef..e079003b 100644 --- a/includes/media/ImageHandler.php +++ b/includes/media/ImageHandler.php @@ -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,19 @@ 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 |