mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-29 13:00:26 +02:00
Merge pull request #5859 from rxu/ticket/16360
[ticket/16360] Fix allocating color for GD 3D image CAPTCHA
This commit is contained in:
@@ -100,7 +100,12 @@ class gd_wave
|
|||||||
{
|
{
|
||||||
$coeff1 = ($i + 12) / 45;
|
$coeff1 = ($i + 12) / 45;
|
||||||
$coeff2 = 1 - $coeff1;
|
$coeff2 = 1 - $coeff1;
|
||||||
$colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb));
|
|
||||||
|
$red = ($coeff2 * $maxr) + ($coeff1 * $minr);
|
||||||
|
$green = ($coeff2 * $maxg) + ($coeff1 * $ming);
|
||||||
|
$blue = ($coeff2 * $maxb) + ($coeff1 * $minb);
|
||||||
|
|
||||||
|
$colors[$i] = imagecolorallocate($img, min([255, (int) $red]), min([255, (int) $green]), min([255, (int) $blue]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// $img_buffer is the last row of 3-space positions (converted to img-space), cached
|
// $img_buffer is the last row of 3-space positions (converted to img-space), cached
|
||||||
|
Reference in New Issue
Block a user