summaryrefslogtreecommitdiff
path: root/includes/media/BMP.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /includes/media/BMP.php
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 'includes/media/BMP.php')
-rw-r--r--includes/media/BMP.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/includes/media/BMP.php b/includes/media/BMP.php
new file mode 100644
index 00000000..9917856a
--- /dev/null
+++ b/includes/media/BMP.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Handler for Microsoft bitmap format (bmp). It inherits most of the methods
+ * from ImageHandler, some of them had to be overriden cause gd does not
+ * support this format.
+ *
+ * @addtogroup Media
+ */
+class BmpHandler extends BitmapHandler {
+
+ /*
+ * Get width and height from the bmp header.
+ */
+ function getImageSize( $image, $filename ) {
+ $f = fopen( $filename, 'r' );
+ if(!$f) return false;
+ $header = fread( $f, 54 );
+ fclose($f);
+
+ // Extract binary form of width and height from the header
+ $w = substr( $header, 18, 4);
+ $h = substr( $header, 22, 4);
+
+ // Convert the unsigned long 32 bits (little endian):
+ $w = unpack( 'V' , $w );
+ $h = unpack( 'V' , $h );
+ return array( $w[1], $h[1] );
+ }
+}
+
+?>