简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM