JPGraph Error


#1

Hello, does dreamhost support jpgraph, I get the following error:

usr/X11R6/lib/x11/fonts/truetype/trubuc.ttf is not readable or does not exist.

How can I correct this, I need to display a graph on my webpage.

Thanks


#2

Add the font to a local directory and update your ENV paths.


#3

Hello, I did that and still receiving the same error.

Thanks


#4

Run this:

<?php
if (function_exists('imagettfbbox')) {
	echo "TTF functions are available.<br>";
	} else {
	echo "TTF functions are not available.<br>";
}
?>

And this:

<?php
// define path to where your fonts are stored
define("TTF_DIR","/fonts/truetype/");
// define a font file that you know that you have
define("TTF_FONTFILE","arial.ttf");
$f = TTF_DIR.TTF_FONTFILE;
if( file_exists($f) === false || is_readable($f) === false ) {
	echo "FAILED: Can not read font file \"$f\".";
} else {
	echo "PASSED: Successfully read font file \"$f\".";
}
?>

#5

The first code gave this result:
TTF functions are available.

The seconf code this:
FAILED: Can not read font file


#6

Did you alter the path and font to reflect your uploaded font’s location ?

[quote]// define path to where your fonts are stored
define(“TTF_DIR”,"/fonts/truetype/");
// define a font file that you know that you have
define(“TTF_FONTFILE”,“arial.ttf”);[/quote]

You did upload a font, yeah?


#7

I’m not using a bunch of fonts, but I’ve ran JPGraph.net (Free Version) without issues.
Was using it for testing and got the full version for my job.
http://www.pgp-protector.com/quakeslastweek.php


#8

Hi,

yes I have uploaded the font and did the above but still same error.

Does the directory “/fonts” where does this start from on the server from the root or from the the direcotry where the php file is run ?

Thanks


#9

That’s probably due to my mistake; I missed a leading “.

./fonts/truetype/”

You can make the path as specific as you like, with your beginning (root) being /home/[username]/

Eg. /home/dimlaz/domain.tld/fonts/arial.ttf

If using a complete path from /home, you can dismiss the preceding .period


#10

Thank you very much for the help, it worked now.

Thanks again


#11

You are more than welcome. Glad everything is working :wink: