Login   Register  
PHP Classes
elePHPant
Icontem

endianness

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      floIcon  >  All threads  >  endianness  >  (Un) Subscribe thread alerts  
Subject:endianness
Summary:ico files are encoded in little-endian
Messages:1
Author:Matthieu Codron
Date:2013-04-29 09:55:22
 

  1. endianness   Reply  
Picture of Matthieu Codron
Matthieu Codron
2013-04-29 09:55:22
while ico files are encoded in little-endian (cf. http://en.wikipedia.org/wiki/ICO_%28file_format%29#Outline), your script does not force unpack to read values as little endian (you are machine endianness dependent).

For example, in \floIconImage::readImageFromICO, you should use

$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/vPlanes/vBitCount/VSizeInBytes/VFileOffset", $this->_entryIconFormat);

and

$this->_header = unpack("VSize/VWidth/VHeight/vPlanes/vBitCount/VCompression/VImageSize/VXpixelsPerM/VYpixelsPerM/VColorsUsed/VColorsImportant", $this->_headerIconFormat);

I did not check all your code against this issue