pchart 错误:消息:imageftbbox() [function.imageftbbox]:字体文件名无效
我尝试了多种不同的方法,现在我已尽可能明确地表达了。我在 Windows 7 上使用 xampp 和 PHP/pChart。在我的代码中,我有:
<?php
include('pChart/pData.class');
include('pChart/pChart.class');
putenv('GDFONTPATH=' . 'C:\Windows');
...
$Test->setFontProperties("/Fonts/tahoma.ttf",8);
...
?>
我确实在字体前面包含了“/”,这样库就不会意外地附加我读到的 .ttf 在某些情况下可能会发生的情况。
任何有关此事的帮助将不胜感激。
I've tried a number of different ways and right now I'm being as explicit as I can. I'm using xampp on Windows 7 with PHP/pChart. In my code I have:
<?php
include('pChart/pData.class');
include('pChart/pChart.class');
putenv('GDFONTPATH=' . 'C:\Windows');
...
$Test->setFontProperties("/Fonts/tahoma.ttf",8);
...
?>
I did include the '/' in front of the Fonts so that the library doesn't accidentaly append a .ttf which I read can happen in some cases.
Any assistance in this matter would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几天前,我使用 pChart,当我从 pChart 文档中复制粘贴示例代码时,出现了同样的错误。只需尝试通过添加完整的绝对路径来添加字体位置:
我将 pChart 库存储在
[root]/libs/pChart/
中。当然,您必须确保您有一个“fonts”文件夹。我的代码可以很好地配合它。所以我猜你的错误是尝试分配系统字体而不是本地包含。I use a few days ago pChart and got same error when i copy-paste example code from pChart documentation. Simply try to add location of font by adding full absolute path to it:
And i store pChart library in
[root]/libs/pChart/
. Of course u must be sure that u have a "fonts" folder. My code works fine with it. So i guess your mistake was in trying to allocate system fonts instead of local includes.