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