Skip to content

Commit

Permalink
web: parse gd version number correctly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidpanderson committed Jul 26, 2024
1 parent de57329 commit 60918aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions html/inc/profile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 60918aa

Please sign in to comment.