You can easily verify this by making sure that your installation of PHP supports some of the 'imagecreate()' functions.
This means that you
If you want to use TTF fonts you must also make sure that your PHP
installation supports TTF fonts (either through FreeType 1 or FreeType
2 libraries). In additions to this you need at least a couple of TTF
fonts. In preparation of using TTF fonts with JpGRaph you must
specify, in jpgraph.php , where those font files can be found.
JpGraph uses a naming convention for the TTF font files in order to be
able to find the correct font files. You should therefore use the font
files that can be downloaded together with JpGraph.
In order to make sure that you have GD installed you could try by
running the following example which creates a very simple image using
just pure GD calls and outputs an image in PNG format.
The above script must work before you will have any
chance of getting JpGraph working.
Please make sure that PHP has write permissions to the cache directory
if you plan to use the cache feature. If not you will get a "Can't
write file xxx.yyy" error when you try to genereate a graph. You can
read more about how to use the cache in the chapter
Making sense of caching system in JpGraph
If you want JPEG support you will also need an
additional library for PHP, again please see PHP documentation for
specifics. For most practical purposes PNG is a better format since it
normally achieves better compression then GIF (typically by a factor
of 2 for the types of images generated by JpGraph). In comparison with
JPEG format PNG is also better for the type of images generated by
this library. So, the bottom line is, you should have a very good
reason to choose any other format then PNG.
By default the image format is set to "auto". This means that JpGraph
automatically chooses the best available graphic using the preferred
order "PNG", "GIF", "JPG".
Note:
The reason that my site (www.aditus.nu) only displays GIF images
is that my Web hotell doesn't support a newer version of GD which
allows PNG format. One of lifes small pains. This is the reason that I
in most places just displays the PNG images directly in the img tag on
my site without going through Jpgraph since the GIF format gives much
bigger files and would make my site slower.
You can find a bug fix for GD 2.01 and the TTF problem together
with Truecolor images at
http://www.coupin.net/gd-freetype/
NOTE: This bug fix has _nothing_ to do with JpGraph and I can't
guarantee anything nor answer any questions regarding this
specific fix.
header ("Content-type: image/png");
$im = @ImageCreate (50, 100)
or die ("Cannot create a new GD image.");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color);
ImagePng ($im);
Customizing the installation
In order for JpGraph to work you must adjust the cache and TTF
directory to suit your installation. By default the TTF directory is
"/usr/local/fonts/ttf/" and for the cache "/tmp/jpgraph_cache/". These are
defined as PHP defines at the top of jpgraph.php
Required files
This is the base library files, which you must have
Plot extension modules
To add plots to the graph you will need one or more of the following
files plot extension files dependiong on what kind of graph you need
to create.
Graphic libraries requirements for PHP 4.02 and above
Per default the standard GD image library supports PNG graphic
formats. You will need to have that installed together with your PHP
module for this library to work at all. Please refer to PHP
documentation on specifics. Note that the newer versions of GD does
not support the GIF format due to copyright problems. Hence by default
only PNG is supported.
Sidenote 2:
To get background images working with GD 2.0.1 you MUST enable
Truecolor images by setting the constant USE_TRUECOLOR to true. If you
don't do this the background images will just be a black rectangle.
The bad thing with this is that the antialias for Truetypes is broken
using truecolor images in GD 2.0.1. This means you can't have
background and TTF fonts in the same image.
Detailed steps to install JpGraph
Troubleshooting your installation
----< QUOTE >----
Build GD 2.0.1 with these two lines in your GD2 Makefile
CFLAGS=-g -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE
LIBS=libgd.a -lpng -lz -ljpeg -freetype -lm
Don't install the lib anywhere, just leave it in the GD-2.1.1
directory.
Then build PHP using a minimum of:
--with-gd=/home/