From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/media/BMP.php | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'includes/media/BMP.php') diff --git a/includes/media/BMP.php b/includes/media/BMP.php index de836b59..6886e950 100644 --- a/includes/media/BMP.php +++ b/includes/media/BMP.php @@ -13,22 +13,39 @@ * @ingroup Media */ class BmpHandler extends BitmapHandler { - // We never want to use .bmp in an tag + + /** + * @param $file + * @return bool + */ function mustRender( $file ) { return true; } - // Render files as PNG + /** + * Render files as PNG + * + * @param $text + * @param $mime + * @param $params + * @return array + */ function getThumbType( $text, $mime, $params = null ) { return array( 'png', 'image/png' ); } - /* + /** * Get width and height from the bmp header. + * + * @param $image + * @param $filename + * @return array */ function getImageSize( $image, $filename ) { - $f = fopen( $filename, 'r' ); - if(!$f) return false; + $f = fopen( $filename, 'rb' ); + if( !$f ) { + return false; + } $header = fread( $f, 54 ); fclose($f); @@ -37,8 +54,12 @@ class BmpHandler extends BitmapHandler { $h = substr( $header, 22, 4); // Convert the unsigned long 32 bits (little endian): - $w = unpack( 'V' , $w ); - $h = unpack( 'V' , $h ); + try { + $w = wfUnpack( 'V', $w, 4 ); + $h = wfUnpack( 'V', $h, 4 ); + } catch ( MWException $e ) { + return false; + } return array( $w[1], $h[1] ); } } -- cgit v1.2.2