X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fmedia%2FGIFMetadataExtractor.php;h=b4c3d6ee11416eea2dbb54b61326a0e68eea0e37;hb=2b5fe6e3f1d01d8b24a1856f016c3c6d120a8855;hp=de409e78e78be9f5b7425e0037dfd4c57d09f4db;hpb=7f91193ef37d534949950c980416b5a921cd5d79;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index de409e78e7..b4c3d6ee11 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -54,9 +54,9 @@ class GIFMetadataExtractor { * @return array */ static function getMetadata( $filename ) { - self::$gifFrameSep = pack( "C", ord( "," ) ); - self::$gifExtensionSep = pack( "C", ord( "!" ) ); - self::$gifTerm = pack( "C", ord( ";" ) ); + self::$gifFrameSep = pack( "C", ord( "," ) ); // 2C + self::$gifExtensionSep = pack( "C", ord( "!" ) ); // 21 + self::$gifTerm = pack( "C", ord( ";" ) ); // 3B $frameCount = 0; $duration = 0.0; @@ -82,8 +82,11 @@ class GIFMetadataExtractor { throw new Exception( "Not a valid GIF file; header: $buf" ); } - // Skip over width and height. - fread( $fh, 4 ); + // Read width and height. + $buf = fread( $fh, 2 ); + $width = unpack( 'v', $buf )[1]; + $buf = fread( $fh, 2 ); + $height = unpack( 'v', $buf )[1]; // Read BPP $buf = fread( $fh, 1 ); @@ -251,6 +254,8 @@ class GIFMetadataExtractor { 'duration' => $duration, 'xmp' => $xmp, 'comment' => $comment, + 'width' => $width, + 'height' => $height, ]; }