我的形象看起來是這樣的:破碎的形象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)。你之前已經問過這個確切的問題。當然,這次你有一個不同的錯誤信息,但這是你的編碼。一半的時間,這是關於調試,這是你必須自己做的事情,這不是一個免費的調試器服務 –