Home > Backend Development > PHP Tutorial > 使用imagettftext函数,页面不显示图片

使用imagettftext函数,页面不显示图片

WBOY
Release: 2016-06-23 13:10:04
Original
1830 people have browsed it

源码如下:
1.2.  header('Content-Type:image/png');
3.
4.  $im=imagecreatefrompng('2.png');
5.  $white=imagecolorallocate($im,0,255,255);
6.  $text=iconv('gbk','UTF-8','asdasd');
7.  $font='C:\Windows\Fonts\Arial\ariblk.ttf';
8.  imagettftext($im,20,0,50,500,$white,$font,$text);
9.  imagepng($im);
10. imagedestroy($im);
11.
12.?>

如果注释第8行代码就可以显示图片,已经检查过GD库是正常的,请问各路大神那个地方还有问题。。。待解救!!


回复讨论(解决方案)

注释掉header那行就知道错在哪了

$font='C:\Windows\Fonts \Arial\ariblk.ttf';
写错了!不存在 Arial 目录

注释掉header那行就知道错在哪了




知道了,感谢大神啊。。

注释掉header那行就知道错在哪了




确实是的,感谢大神哈
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template