From 60918aa796f40919f5a2556a1b520dd6bed75ce3 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 26 Jul 2024 16:17:34 -0700 Subject: [PATCH] web: parse gd version number correctly We were checking specifically for '2.0'. If you had a later version (like 2.2) it would think you had an old version, and use an old image conversion function that produces wrong-colored results. --- html/inc/profile.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html/inc/profile.inc b/html/inc/profile.inc index 8dd91b35f0d..fdbf4f74c7a 100644 --- a/html/inc/profile.inc +++ b/html/inc/profile.inc @@ -136,8 +136,10 @@ function scale_image( } $gd_info = gd_info(); - $newGD = (strstr($gd_info["GD Version"], "2.0")!=""); - if ($newGD) { + $v = $gd_info["GD Version"]; + $v = explode('.', $v); + $v = (int)$v[0]; // major version + if ($v >= 2) { // If you are using a modern PHP/GD installation that does // 'truecolor' images, this is what's needed. $newImage = ImageCreateTrueColor($destWidth, $destHeight);