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:2
Author:Matthieu Codron
Date:2013-04-29 09:55:22
 

  1. endianness   Reply   Report abuse  
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

  2. Re: endianness   Reply   Report abuse  
Picture of Joshua hatfield Joshua hatfield - 2015-04-08 16:33:12 - In reply to message 1 from Matthieu Codron
Thank you. I'll see about that.