安全验证码图像不显示在000webhost中

时间:2013-03-03 14:09:07

标签: php

我已将我的网站上传到000webhost,但在我的注册表单中,安全验证码图像在我的本地主机中显示时未显示。

我的验证码是:

<?php
include_once('includes/session.php');
$_SESSION['secure']=rand(1000,9999);
header('content-type:image/jpeg');
$text=$_SESSION['secure'];
$font_size=25;
$image_width=200;
$image_height=40;
$image=imagecreate($image_width,$image_height);
imagecolorallocate($image,255,255,255);
$text_color=imagecolorallocate($image,0,0,0);
for($x=1;$x<=40;$x++)
{$x1=rand(1,120);
$x2=rand(1,120);
$y1=rand(1,120);
$y2=rand(1,120);
imageline($image,$x1,$y1,$x2,$y2,$text_color);    
}
imagettftext($image,$font_size,0,15,30,$text_color,'MAGNETOB.TTF',$text);
imagejpeg($image);
?>

我将验证码显示为:

<img src="captcha1.php" id="captcha" />

我的代码出了什么问题?

1 个答案:

答案 0 :(得分:0)

您是否已激活GD扩展程序?