开发者

pchart error: Message: imageftbbox() [function.imageftbbox]: Invalid font filename

开发者 https://www.devze.com 2023-03-31 20:36 出处:网络
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:

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');

        ...
    $开发者_StackOverflow社区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.


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:

$font_folder = $_SERVER['DOCUMENT_ROOT']."/libs/pChart/fonts/";
$Test->setFontProperties($font_folder."/Fonts/tahoma.ttf",8); 

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消