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