参考:http://blog.csdn.net/zycamym/article/details/11913407
参考:http://php.net/manual/en/function.imagettftext.php
试试使用绝对路径。
1 2 3 4 5 | if ($font== "" ){ $font= "/usr/local/apache2/htdocs/fonts/Curly.TTF" ; } else { $font= "/usr/local/apache2/htdocs/fonts/$font" ; } |
或者按官网的解决办法在使用imagettfbbox()函数前设置GDFONTPATH环境变量;
源码:Instant Logo Maker 在线图标生成器:
1 2 3 4 5 6 | putenv( 'GDFONTPATH=' . realpath( '.' )); if ($font== "" ){ $font= "fonts/Curly.TTF" ; } else { $font= "fonts/$font" ; } |
源码:barcodephp.com > class/BCGFont.php
1 2 3 4 5 6 7 8 9 10 11 12 13 | putenv( 'GDFONTPATH=' . realpath( '.' )); interface BCGFont { public /*internal*/ function getText(); public /*internal*/ function setText($text); public /*internal*/ function getRotationAngle(); public /*internal*/ function setRotationAngle($rotationDegree); public /*internal*/ function getBackgroundColor(); public /*internal*/ function setBackgroundColor($backgroundColor); public /*internal*/ function getForegroundColor(); public /*internal*/ function setForegroundColor($foregroundColor); public /*internal*/ function getDimension(); public /*internal*/ function draw($im, $x, $y); } |