From 15ffdff3875828ee61dae665b765cefbde274ffa Mon Sep 17 00:00:00 2001 From: im-mi Date: Fri, 2 Sep 2016 02:16:07 -0400 Subject: [PATCH] Fix .ico when size is 256 x 256 --- ext/handle_ico/main.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/handle_ico/main.php b/ext/handle_ico/main.php index 83cd9d56..8bb9932f 100644 --- a/ext/handle_ico/main.php +++ b/ext/handle_ico/main.php @@ -72,8 +72,10 @@ class IcoFileHandler extends Extension { $subheader = unpack("cwidth/cheight/ccolours/cnull/splanes/sbpp/lsize/loffset", fread($fp, 16)); fclose($fp); - $image->width = $subheader['width']; - $image->height = $subheader['height']; + $width = $subheader['width']; + $height = $subheader['height']; + $image->width = width == 0 ? 256 : width; + $image->height = height == 0 ? 256 : height; $image->filesize = $metadata['size']; $image->hash = $metadata['hash'];