8 * Handler for Microsoft's bitmap format; getimagesize() doesn't
13 class BmpHandler
extends BitmapHandler
{
14 // We never want to use .bmp in an <img/> tag
15 function mustRender( $file ) {
19 // Render files as PNG
20 function getThumbType( $text, $mime ) {
21 return array( 'png', 'image/png' );
25 * Get width and height from the bmp header.
27 function getImageSize( $image, $filename ) {
28 $f = fopen( $filename, 'r' );
30 $header = fread( $f, 54 );
33 // Extract binary form of width and height from the header
34 $w = substr( $header, 18, 4);
35 $h = substr( $header, 22, 4);
37 // Convert the unsigned long 32 bits (little endian):
38 $w = unpack( 'V' , $w );
39 $h = unpack( 'V' , $h );
40 return array( $w[1], $h[1] );