3 * Handler for Microsoft's bitmap format
10 * Handler for Microsoft's bitmap format; getimagesize() doesn't
15 class BmpHandler
extends BitmapHandler
{
21 function mustRender( $file ) {
33 function getThumbType( $text, $mime, $params = null ) {
34 return array( 'png', 'image/png' );
38 * Get width and height from the bmp header.
44 function getImageSize( $image, $filename ) {
45 $f = fopen( $filename, 'rb' );
49 $header = fread( $f, 54 );
52 // Extract binary form of width and height from the header
53 $w = substr( $header, 18, 4);
54 $h = substr( $header, 22, 4);
56 // Convert the unsigned long 32 bits (little endian):
58 $w = wfUnpack( 'V', $w, 4 );
59 $h = wfUnpack( 'V', $h, 4 );
60 } catch ( MWException
$e ) {
63 return array( $w[1], $h[1] );