Catch some more references to the hard coded size and change to the variable one.
This commit is contained in:
parent
2ccb30cd8d
commit
878ff4d33f
|
@ -33,10 +33,10 @@ class CaptchaGenerator {
|
||||||
// Draw random lines
|
// Draw random lines
|
||||||
for ($t=0; $t<10; $t++) {
|
for ($t=0; $t<10; $t++) {
|
||||||
$tcol = imagecolorallocate($i, 100+mt_rand(0,150), 100+mt_rand(0,150), 100+mt_rand(0,150));
|
$tcol = imagecolorallocate($i, 100+mt_rand(0,150), 100+mt_rand(0,150), 100+mt_rand(0,150));
|
||||||
$Xa = mt_rand(0, 120);
|
$Xa = mt_rand(0, $width);
|
||||||
$Ya = mt_rand(0, 40);
|
$Ya = mt_rand(0, $height);
|
||||||
$Xb = mt_rand(0, 120);
|
$Xb = mt_rand(0, $width);
|
||||||
$Yb = mt_rand(0, 40);
|
$Yb = mt_rand(0, $height);
|
||||||
imageline($i, $Xa, $Ya, $Xb, $Yb, $tcol);
|
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);
|
imagettftext($i, 28, 0, 5, 32, $col, dirname(__FILE__).'/Font/captcha.ttf', $this->value);
|
||||||
|
|
||||||
// Distort the image
|
// Distort the image
|
||||||
$X = mt_rand(0, 120);
|
$X = mt_rand(0, $width);
|
||||||
$Y = mt_rand(0, 40);
|
$Y = mt_rand(0, $height);
|
||||||
$Phase=mt_rand(0,10);
|
$Phase=mt_rand(0,10);
|
||||||
$Scale = 1.3 + mt_rand(0,10000)/30000;
|
$Scale = 1.3 + mt_rand(0,10000)/30000;
|
||||||
$Amp=1+mt_rand(0,1000)/1000;
|
$Amp=1+mt_rand(0,1000)/1000;
|
||||||
$out = imagecreatetruecolor(120,40);
|
$out = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
for ($x=0; $x<120; $x++)
|
for ($x=0; $x<$width; $x++)
|
||||||
for ($y=0; $y<40; $y++) {
|
for ($y=0; $y<$height; $y++) {
|
||||||
$Vx=$x-$X;
|
$Vx=$x-$X;
|
||||||
$Vy=$y-$Y;
|
$Vy=$y-$Y;
|
||||||
$Vn=sqrt($Vx*$Vx+$Vy*$Vy);
|
$Vn=sqrt($Vx*$Vx+$Vy*$Vy);
|
||||||
|
|
Loading…
Reference in New Issue