MediaWiki
REL1_19
|
00001 <?php 00015 class BmpHandler extends BitmapHandler { 00016 00021 function mustRender( $file ) { 00022 return true; 00023 } 00024 00033 function getThumbType( $text, $mime, $params = null ) { 00034 return array( 'png', 'image/png' ); 00035 } 00036 00044 function getImageSize( $image, $filename ) { 00045 $f = fopen( $filename, 'rb' ); 00046 if( !$f ) { 00047 return false; 00048 } 00049 $header = fread( $f, 54 ); 00050 fclose($f); 00051 00052 // Extract binary form of width and height from the header 00053 $w = substr( $header, 18, 4); 00054 $h = substr( $header, 22, 4); 00055 00056 // Convert the unsigned long 32 bits (little endian): 00057 try { 00058 $w = wfUnpack( 'V', $w, 4 ); 00059 $h = wfUnpack( 'V', $h, 4 ); 00060 } catch ( MWException $e ) { 00061 return false; 00062 } 00063 return array( $w[1], $h[1] ); 00064 } 00065 }