lib/Type/TypeWebp.php
protected function getWebpSize($data, $format)
	{
		switch ($format)
		{
			case self::WEBP_FORMAT_SIMPLE:
				$this->size = unpack('vwidth/vheight', substr($data, 10, 4));
			break;

			case self::WEBP_FORMAT_LOSSLESS:
				// Lossless uses 14-bit values so we'll have to use bitwise shifting
				$this->size = array(
					'width'		=> ord($data[5]) + ((ord($data[6]) & 0x3F) << 8) + 1,
					'height'	=> (ord($data[6]) >> 6) + (ord($data[7]) << 2) + ((ord($data[8]) & 0xF) << 10) + 1,
				);
			break;

			case self::WEBP_FORMAT_EXTENDED:
				// Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough
				$this->size = array(
					'width'		=> ord($data[8]) + (ord($data[9]) << 8) + (ord($data[10]) << 16) + 1,
					'height'	=> ord($data[11]) + (ord($data[12]) << 8) + (ord($data[13]) << 16) + 1,
				);
			break;
		}
	}
protected function getWebpSize($data, $format)
	{
		switch ($format)
		{
			case self::WEBP_FORMAT_SIMPLE:
				$this->size = unpack('vwidth/vheight', substr($data, 10, 4));
			break;

			case self::WEBP_FORMAT_LOSSLESS:
				// Lossless uses 14-bit values so we'll have to use bitwise shifting
				$this->size = array(
					'width'		=> ord($data[5]) + ((ord($data[6]) & 0x3F) << 8) + 1,
					'height'	=> (ord($data[6]) >> 6) + (ord($data[7]) << 2) + ((ord($data[8]) & 0xF) << 10) + 1,
				);
			break;

			case self::WEBP_FORMAT_EXTENDED:
				// Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough
				$this->size = array(
					'width'		=> ord($data[8]) + (ord($data[9]) << 8) + (ord($data[10]) << 16) + 1,
					'height'	=> ord($data[11]) + (ord($data[12]) << 8) + (ord($data[13]) << 16) + 1,
				);
			break;
		}
	}
protected function getWebpSize ( $ data , $ format ) { switch ( $ format ) { case self :: WEBP_FORMAT_SIMPLE : $ this -> size = unpack ( 'vwidth/vheight' , substr ( $ data , 10 , 4 ) ) ; break ; case self :: WEBP_FORMAT_LOSSLESS : // Lossless uses 14-bit values so we'll have to use bitwise shifting $ this -> size = array ( 'width' => ord ( $ data [ 5 ] ) + ( ( ord ( $ data [ 6 ] ) & 0x3F ) << 8 ) + 1 , 'height' => ( ord ( $ data [ 6 ] ) >> 6 ) + ( ord ( $ data [ 7 ] ) << 2 ) + ( ( ord ( $ data [ 8 ] ) & 0xF ) << 10 ) + 1 , ) ; break ; case self :: WEBP_FORMAT_EXTENDED : // Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough $ this -> size = array ( 'width' => ord ( $ data [ 8 ] ) + ( ord ( $ data [ 9 ] ) << 8 ) + ( ord ( $ data [ 10 ] ) << 16 ) + 1 , 'height' => ord ( $ data [ 11 ] ) + ( ord ( $ data [ 12 ] ) << 8 ) + ( ord ( $ data [ 13 ] ) << 16 ) + 1 , ) ; break ; } }
Get webp size info depending on format type and set size array values

@param string $data Data string
@param string $format Format string
Get webp size info depending on format type and set size array values