floIcon: add experimental SizeInBytes cap
This commit is contained in:
parent
ce2b219c64
commit
6a1f424924
|
@ -16,13 +16,13 @@ Date: 2009-03-16
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
I was a little hasty on that last update. A couple new bugs from 1.1.0 have
|
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:
|
Version 1.1.0:
|
||||||
Date: 2009-03-16
|
Date: 2009-03-16
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
Added Vista support.
|
Added Vista support.
|
||||||
Fixed a number of minor bugs. Many thanks to Dvir Berebi for pointing
|
Fixed a number of minor bugs. Many thanks to Dvir Berebi for pointing
|
||||||
them out.
|
them out.
|
||||||
|
|
||||||
|
@ -291,8 +291,9 @@ class floIcon {
|
||||||
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
|
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
|
||||||
for ($t = 0; $t < $header["Count"]; $t++) {
|
for ($t = 0; $t < $header["Count"]; $t++) {
|
||||||
$newImage = new floIconImage();
|
$newImage = new floIconImage();
|
||||||
$newImage->readImageFromICO($filePointer, 6 + ($t * 16));
|
if ($newImage->readImageFromICO($filePointer, 6 + ($t * 16))) {
|
||||||
$this->images[] = $newImage;
|
$this->images[] = $newImage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose($filePointer);
|
fclose($filePointer);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +387,7 @@ class floIconImage {
|
||||||
imagealphablending($imageResource, false);
|
imagealphablending($imageResource, false);
|
||||||
$height = imagesy($imageResource);
|
$height = imagesy($imageResource);
|
||||||
$width = imagesx($imageResource);
|
$width = imagesx($imageResource);
|
||||||
|
|
||||||
// Parse resource to determine header and icon format
|
// Parse resource to determine header and icon format
|
||||||
|
|
||||||
// Find Palette information
|
// Find Palette information
|
||||||
|
@ -637,7 +638,7 @@ class floIconImage {
|
||||||
$this->_imageIconFormat = $imageAsPng;
|
$this->_imageIconFormat = $imageAsPng;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function _createImageResource() {
|
function _createImageResource() {
|
||||||
if ($newImage = @imagecreatefromstring($this->_headerIconFormat.$this->_imageIconFormat)) {
|
if ($newImage = @imagecreatefromstring($this->_headerIconFormat.$this->_imageIconFormat)) {
|
||||||
|
@ -780,6 +781,9 @@ class floIconImage {
|
||||||
$this->_entryIconFormat = fread($filePointer, 16);
|
$this->_entryIconFormat = fread($filePointer, 16);
|
||||||
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
|
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
|
||||||
|
|
||||||
|
if ($this->_entry["SizeInBytes"] > 16384)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Position the file pointer.
|
// Position the file pointer.
|
||||||
fseek($filePointer, $this->_entry["FileOffset"]);
|
fseek($filePointer, $this->_entry["FileOffset"]);
|
||||||
|
|
||||||
|
@ -815,7 +819,9 @@ class floIconImage {
|
||||||
}
|
}
|
||||||
if ($this->_entry["Height"] == 0) {
|
if ($this->_entry["Height"] == 0) {
|
||||||
$this->_entry["Height"] = $this->_header["Height"]/2;
|
$this->_entry["Height"] = $this->_header["Height"]/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
function getHeader() {
|
function getHeader() {
|
||||||
return $this->_header;
|
return $this->_header;
|
||||||
|
@ -840,4 +846,4 @@ class floIconImage {
|
||||||
$this->_imageResource = null;
|
$this->_imageResource = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue