Php 由gd库创建的图像上未显示文本

Php 由gd库创建的图像上未显示文本,php,file,gd,gdlib,Php,File,Gd,Gdlib,我已经开发了这个图像代码,但问题是,我的文字没有出现在这个图像上,请帮助!代码运行良好,没有错误。显示此代码中提到的白色图像 <?php //Set the Content Type header('Content-type: image/jpg'); $w=730; $h=450; $image=imagecreate($w,$h); $text='hello world'; $whitebackground=imagecolorallocate($image,255,255,25

我已经开发了这个图像代码,但问题是,我的文字没有出现在这个图像上,请帮助!代码运行良好,没有错误。显示此代码中提到的白色图像

<?php
//Set the Content Type
header('Content-type: image/jpg');

$w=730;
$h=450;

$image=imagecreate($w,$h);
$text='hello world';

$whitebackground=imagecolorallocate($image,255,255,255);

$blacktext=imagecolorallocate($image,0,0,0);
$font =$font_path = dirname(__FILE__) . '/themify.ttf';

imagettftext($image,40,0,50,50,$blacktext,$font,$text);
imagejpeg($image);

ini_set("log_errors", 1); ini_set("error_log", "php-error.log");
?>

我已经运行了以下代码,它工作正常。唯一的变化是字体类型,我使用了arial.ttf字体。我已附加输出文件

<?php
//Set the Content Type
header('Content-type: image/jpg');

$w=730;
$h=450;

$image=imagecreate($w,$h);
$text='hello world';

$whitebackground=imagecolorallocate($image,255,255,255);

$blacktext=imagecolorallocate($image,0,0,0);
$font =$font_path = dirname(__FILE__) . '/arial.ttf';

imagettftext($image,40,0,50,50,$blacktext,$font,$text);
imagejpeg($image);
?>


在调用函数之前,您应该真正设置日志记录配置。当您在此处执行此操作时,捕获任何有用的内容都为时已晚。如何执行此操作我是PHP新手只需使用
ini\u set
调用将行移动到顶部即可。日志文件已空,我还没有尝试过这么多,但我认为它会运行良好。所以为什么给定的字体不起作用?