ImageString字体大小高于5

时间:2012-11-18 11:56:47

标签: php gd

我确定这很简单,但我还是非常初学者。 有一个名为ImageString的php函数,它是我可以用来将文本转换为图像的唯一函数,我不知道为什么,但即使是php手册中的任何脚本(复制粘贴)都不能与我合作。

我想要的是将字体大小更改为大于5的字体。

这是我的代码

header ("Content-type: image/jpeg"); 
// imagecreate (x width, y width)
$img_handle = imagecreatetruecolor (800, 600) or die ("Cannot Create image"); 
// ImageColorAllocate (image, red, green, blue)
$back_color = ImageColorAllocate ($img_handle, 0, 0, 0); 
$txt_color = ImageColorAllocate ($img_handle, 243,203,146); 
imagecolortransparent($img_handle, $back_color);
$text = 'soem text goes here';
ImageString($img_handle, 40, 10,90, $text, $txt_color);
Imagejpeg ($img_handle); 
ImageDestroy($img_handle);

2 个答案:

答案 0 :(得分:1)

与生成验证码图像时的技术相同可能有效。

答案 1 :(得分:0)

您在函数名称中使用大写字母。使用imagecolorallocate代替ImageColorAllocate

ImageStringImagejpegImageDestroy相同,它们都需要小写。