8 * Handler for Microsoft's bitmap format; getimagesize() doesn't
13 class BmpHandler
extends BitmapHandler
{
16 * Get width and height from the bmp header.
18 function getImageSize( $image, $filename ) {
19 $f = fopen( $filename, 'r' );
21 $header = fread( $f, 54 );
24 // Extract binary form of width and height from the header
25 $w = substr( $header, 18, 4);
26 $h = substr( $header, 22, 4);
28 // Convert the unsigned long 32 bits (little endian):
29 $w = unpack( 'V' , $w );
30 $h = unpack( 'V' , $h );
31 return array( $w[1], $h[1] );