【发布时间】:2014-01-27 13:39:50
【问题描述】:
我在 mozilla 上遇到这个错误
"图片 “*/form%20and%20its%20validation/New%20folder/captcha/captcha.php” 无法显示,因为它包含错误。”
fonts.ttf 位于同一文件夹中。
并且这段代码在 chrome 上没有显示任何内容。这段代码有什么问题?
我想在我的表单页面中包含这个..
$rnum='';
//generating random number
$rnum = rand(100000,9999999);
//creating image with size 300*60
$imgo = imagecreatetruecolor(300,60);
$white = imagecolorallocate($imgo, 255, 255, 255);
$grey = imagecolorallocate($imgo, 128, 128, 128);
$red = imagecolorallocate($imgo, 200, 100,90);
$black = imagecolorallocate($imgo, 0, 0, 0);
imagefilledrectangle($imgo, 0, 0, 200, 35, $black);
//getting font
$cfont= 'font.ttf';
imagettftext($imgo, 35, 0, 22, 24, $red, $cfont, $rnum);
header ("Content-type: image/png");
imagepng($imgo);
imagedestroy($imgo);
【问题讨论】:
标签: php