我的形象看起来是这样的:破碎的形象PHP(GD)
其从antibot.php
这里得到的图像是我antibot.php
<?php
session_start();
$width = 75;
$height = 40;
$length = 3;
$baseList = '1234567890';
$code = "";
$counter = 0;
$image = @imagecreate($width, $height) or die('Kunne ikke velge GD!');
for($i=0; $i<10; $i++){
imageline($image,
mt_rand(0,$width), mt_rand(0,$height),
mt_rand(0,$width), mt_rand(0,$height),
imagecolorallocate($image, mt_rand(150,255),
mt_rand(150,255),
mt_rand(150,255)))) or die('Kunne ikke velge line!');
}
for($i=0, $x=0; $i<$length; $i++){
$actChar = substr($baseList, rand(0, strlen($baseList)-1), 1);
$x += 10 + mt_rand(0,10);
imagechar($image, mt_rand(3,5), $x, mt_rand(5,20), $actChar,
imagecolorallocate($image, mt_rand(0,155), mt_rand(0,155), mt_rand(0,155)))) or die('Kunne ikke velge GD2!');
$code .= strtolower($actChar)) or die('Kunne ikke velge GD3!');
}
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
$_SESSION['securityCode'] = $code;
?>
我已经安装GD和freetype,有谁能帮我解决这个问题吗?
为什么要经历重新发明轮子的所有麻烦。如果你问我,使用captcha就更容易了。以前全部完成... –
请在浏览器中打开图像URI并粘贴输出。您可能在第二个* for *循环中出现语法错误。 – ComFreek
[Image不会显示(PHP和GD)]的可能重复](http://stackoverflow.com/questions/18300535/image-wont-show-php-and-gd)。你之前已经问过这个确切的问题。当然,这次你有一个不同的错误信息,但这是你的编码。一半的时间,这是关于调试,这是你必须自己做的事情,这不是一个免费的调试器服务 –