Catch some more references to the hard coded size and change to the variable one.

This commit is contained in:
Gregory McLean 2011-09-09 09:57:05 -04:00
parent 2ccb30cd8d
commit 878ff4d33f
1 changed files with 9 additions and 9 deletions

View File

@ -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);