3 * Handler for Microsoft bitmap format (bmp). It inherits most of the methods
4 * from ImageHandler, some of them had to be overriden cause gd does not
9 class BmpHandler
extends BitmapHandler
{
12 * Get width and height from the bmp header.
14 function getImageSize( $image, $filename ) {
15 $f = fopen( $filename, 'r' );
17 $header = fread( $f, 54 );
20 // Extract binary form of width and height from the header
21 $w = substr( $header, 18, 4);
22 $h = substr( $header, 22, 4);
24 // Convert the unsigned long 32 bits (little endian):
25 $w = unpack( 'V' , $w );
26 $h = unpack( 'V' , $h );
27 return array( $w[1], $h[1] );