From 878ff4d33f091a88d83bdba4b573cc36f969e45b Mon Sep 17 00:00:00 2001 From: Gregory McLean Date: Fri, 9 Sep 2011 09:57:05 -0400 Subject: [PATCH] Catch some more references to the hard coded size and change to the variable one. --- Generator/CaptchaGenerator.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 82247e5..2981c45 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -33,10 +33,10 @@ class CaptchaGenerator { // Draw random lines for ($t=0; $t<10; $t++) { $tcol = imagecolorallocate($i, 100+mt_rand(0,150), 100+mt_rand(0,150), 100+mt_rand(0,150)); - $Xa = mt_rand(0, 120); - $Ya = mt_rand(0, 40); - $Xb = mt_rand(0, 120); - $Yb = mt_rand(0, 40); + $Xa = mt_rand(0, $width); + $Ya = mt_rand(0, $height); + $Xb = mt_rand(0, $width); + $Yb = mt_rand(0, $height); imageline($i, $Xa, $Ya, $Xb, $Yb, $tcol); } @@ -44,15 +44,15 @@ class CaptchaGenerator { imagettftext($i, 28, 0, 5, 32, $col, dirname(__FILE__).'/Font/captcha.ttf', $this->value); // Distort the image - $X = mt_rand(0, 120); - $Y = mt_rand(0, 40); + $X = mt_rand(0, $width); + $Y = mt_rand(0, $height); $Phase=mt_rand(0,10); $Scale = 1.3 + mt_rand(0,10000)/30000; $Amp=1+mt_rand(0,1000)/1000; - $out = imagecreatetruecolor(120,40); + $out = imagecreatetruecolor($width, $height); - for ($x=0; $x<120; $x++) - for ($y=0; $y<40; $y++) { + for ($x=0; $x<$width; $x++) + for ($y=0; $y<$height; $y++) { $Vx=$x-$X; $Vy=$y-$Y; $Vn=sqrt($Vx*$Vx+$Vy*$Vy);