X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FPNGMetadataExtractor.php;h=78ed0bcdc5646a901b793f33898c08810bea4e1b;hb=8624538de243da3779db5eb3362bedf78d2e2931;hp=d0517d7a56ccebdae25a02dabf935063b7d3dd8c;hpb=4cb9c1a24bde6e29c5e8f05c7cd1de54ffdd342a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/PNGMetadataExtractor.php b/includes/media/PNGMetadataExtractor.php index d0517d7a56..78ed0bcdc5 100644 --- a/includes/media/PNGMetadataExtractor.php +++ b/includes/media/PNGMetadataExtractor.php @@ -121,6 +121,8 @@ class PNGMetadataExtractor { if ( !$buf || strlen( $buf ) < $chunk_size ) { throw new Exception( __METHOD__ . ": Read error" ); } + $width = unpack( 'N', substr( $buf, 0, 4 ) )[1]; + $height = unpack( 'N', substr( $buf, 4, 4 ) )[1]; $bitDepth = ord( substr( $buf, 8, 1 ) ); // Detect the color type in British English as per the spec // https://www.w3.org/TR/PNG/#11IHDR @@ -200,9 +202,9 @@ class PNGMetadataExtractor { // if compressed if ( $items[2] == "\x01" ) { if ( function_exists( 'gzuncompress' ) && $items[4] === "\x00" ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $items[5] = gzuncompress( $items[5] ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $items[5] === false ) { // decompression failed @@ -244,9 +246,9 @@ class PNGMetadataExtractor { fseek( $fh, self::$crcSize, SEEK_CUR ); continue; } - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $content = iconv( 'ISO-8859-1', 'UTF-8', $content ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $content === false ) { throw new Exception( __METHOD__ . ": Read error (error with iconv)" ); @@ -284,9 +286,9 @@ class PNGMetadataExtractor { continue; } - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $content = gzuncompress( $content ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $content === false ) { // decompression failed @@ -295,9 +297,9 @@ class PNGMetadataExtractor { continue; } - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $content = iconv( 'ISO-8859-1', 'UTF-8', $content ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $content === false ) { throw new Exception( __METHOD__ . ": Read error (error with iconv)" );