From 40afee5d1295729105dbebf7f042ccdadd9fae41 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen <645432-yan12125@users.noreply.gitlab.com> Date: Fri, 10 Feb 2023 18:20:42 +0800 Subject: [PATCH] Fix calculating average color for *.ico Currently colorPalette() always fails for *.ico due to a logic error. It's a regression from 8f749fe61b038833069c4e2d0dec4749643b4371. --- include/colors.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/colors.php b/include/colors.php index 5682b55a1..64e24f8f1 100644 --- a/include/colors.php +++ b/include/colors.php @@ -355,8 +355,9 @@ function colorPalette(string $imageFile, int $numColors, int $granularity = 5): } else { $img = @$ico->images[count($ico->images)-1]->getImageResource(); } + } else { + return null; } - return null; } else if ($size[0] > 0 && $size[1] > 0) { $img = @imagecreatefromstring(file_get_contents($imageFile)); }