Changes:
I was a little hasty on that last update. A couple new bugs from 1.1.0 have
-been fixed.
+been fixed.
Version 1.1.0:
Date: 2009-03-16
Changes:
-Added Vista support.
+Added Vista support.
Fixed a number of minor bugs. Many thanks to Dvir Berebi for pointing
them out.
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
for ($t = 0; $t < $header["Count"]; $t++) {
$newImage = new floIconImage();
- $newImage->readImageFromICO($filePointer, 6 + ($t * 16));
- $this->images[] = $newImage;
+ if ($newImage->readImageFromICO($filePointer, 6 + ($t * 16))) {
+ $this->images[] = $newImage;
+ }
}
fclose($filePointer);
}
imagealphablending($imageResource, false);
$height = imagesy($imageResource);
$width = imagesx($imageResource);
-
+
// Parse resource to determine header and icon format
// Find Palette information
$this->_imageIconFormat = $imageAsPng;
}
-
+
}
function _createImageResource() {
if ($newImage = @imagecreatefromstring($this->_headerIconFormat.$this->_imageIconFormat)) {
$this->_entryIconFormat = fread($filePointer, 16);
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
+ if ($this->_entry["SizeInBytes"] > 16384)
+ return false;
+
// Position the file pointer.
fseek($filePointer, $this->_entry["FileOffset"]);
}
if ($this->_entry["Height"] == 0) {
$this->_entry["Height"] = $this->_header["Height"]/2;
- }
+ }
+
+ return true;
}
function getHeader() {
return $this->_header;
$this->_imageResource = null;
}
}
-?>
\ No newline at end of file
+?>