Read ICO header with proper sign
Fixes width/height being read incorrectly when >= 128
This commit is contained in:
parent
d9485bbb40
commit
1dd0dfc591
1 changed files with 3 additions and 3 deletions
|
@ -67,9 +67,9 @@ class IcoFileHandler extends Extension {
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
|
|
||||||
$fp = fopen($filename, "r");
|
$fp = fopen($filename, "r");
|
||||||
$header = unpack("snull/stype/scount", fread($fp, 6));
|
$header = unpack("Snull/Stype/Scount", fread($fp, 6));
|
||||||
|
|
||||||
$subheader = unpack("cwidth/cheight/ccolours/cnull/splanes/sbpp/lsize/loffset", fread($fp, 16));
|
$subheader = unpack("Cwidth/Cheight/Ccolours/Cnull/Splanes/Sbpp/Lsize/loffset", fread($fp, 16));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$width = $subheader['width'];
|
$width = $subheader['width'];
|
||||||
|
@ -94,7 +94,7 @@ class IcoFileHandler extends Extension {
|
||||||
private function check_contents($file) {
|
private function check_contents($file) {
|
||||||
if(!file_exists($file)) return false;
|
if(!file_exists($file)) return false;
|
||||||
$fp = fopen($file, "r");
|
$fp = fopen($file, "r");
|
||||||
$header = unpack("snull/stype/scount", fread($fp, 6));
|
$header = unpack("Snull/Stype/Scount", fread($fp, 6));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
return ($header['null'] == 0 && ($header['type'] == 0 || $header['type'] == 1));
|
return ($header['null'] == 0 && ($header['type'] == 0 || $header['type'] == 1));
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue