BUGFIX: fixed issue with greyscale GD - patch from camspiers

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@74272 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Will Rossiter 2009-04-08 03:21:07 +00:00 committed by Sam Minnee
parent 4b12d00697
commit 23044a94dd

View File

@ -352,8 +352,8 @@ class GD extends Object {
$rr = ($rv == 0) ? 0 : 1/($rt/$rv); $rr = ($rv == 0) ? 0 : 1/($rt/$rv);
$br = ($bv == 0) ? 0 : 1/($rt/$bv); $br = ($bv == 0) ? 0 : 1/($rt/$bv);
$gr = ($gv == 0) ? 0 : 1/($rt/$gv); $gr = ($gv == 0) ? 0 : 1/($rt/$gv);
for($dy = 0; $dy <= $height; $dy++) { for($dy = 0; $dy < $height; $dy++) {
for($dx = 0; $dx <= $width; $dx++) { for($dx = 0; $dx < $width; $dx++) {
$pxrgb = imagecolorat($this->gd, $dx, $dy); $pxrgb = imagecolorat($this->gd, $dx, $dy);
$heightgb = ImageColorsforIndex($this->gd, $pxrgb); $heightgb = ImageColorsforIndex($this->gd, $pxrgb);
$newcol = ($rr*$heightgb['red']) + ($br*$heightgb['blue']) + ($gr*$heightgb['green']); $newcol = ($rr*$heightgb['red']) + ($br*$heightgb['blue']) + ($gr*$heightgb['green']);