使用php将文本转换为图像

使用php将文本转换为图像,php,Php,我能够创建图像,但不能在图像上写任何东西 我也没有收到任何错误消息。这是我的密码: $ouput ="uploads/jersey/img1.jpg"; $x=720; $y=480; $image = imagecreate($x,$y); $white = imagecolorallocate($image,95,73,255); $black = imagecolorallocate($image,0,0,0); $white = imagecolorallocate($image,255

我能够创建图像,但不能在图像上写任何东西

我也没有收到任何错误消息。这是我的密码:

$ouput ="uploads/jersey/img1.jpg";
$x=720;
$y=480;
$image = imagecreate($x,$y);
$white = imagecolorallocate($image,95,73,255);
$black = imagecolorallocate($image,0,0,0);
$white = imagecolorallocate($image,255,255,255);
$fs =40;
$rotation = 0;
$origin_x = 20;
$origin_y = 20;
$font = "./arial.ttf";
imagefttext("$image",16,0,0,16,$black,$font,"test");
imagejpeg($image,$ouput);
你能帮我解决这个问题吗?

更改此选项:

imagefttext("$image",16,0,0,16,$black,$font,"test");
为此:

imagefttext($image,16,0,0,16,$black,$font,"test");

以下是错误消息:

PHP Warning:  imagefttext() expects parameter 1 to be resource, string given in /tmp/index.php on line 15
您是否在正确的位置查找脚本的错误消息?从命令行运行脚本或查看Web服务器的错误日志。它将类似于
/var/log/httpd/error\u log

更改以下内容:

imagefttext("$image",16,0,0,16,$black,$font,"test");
为此:

imagefttext($image,16,0,0,16,$black,$font,"test");

以下是错误消息:

PHP Warning:  imagefttext() expects parameter 1 to be resource, string given in /tmp/index.php on line 15

您是否在正确的位置查找脚本的错误消息?从命令行运行脚本或查看Web服务器的错误日志。如果你问一些问题,一定要用一些大家都能理解的短语,比如
/var/log/httpd/error\u log

。不要让它像你做的那样短。如果你问一些事情,确保你使用一些大家都容易理解的短语。不要像你做的那样短。