| 1 |
lars |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
|
|
|
5 |
<LINK REL="Start" HREF="index.html">
|
|
|
6 |
<LINK REL="Contents" HREF="toc.html">
|
|
|
7 |
<LINK REL="Prev" HREF="421UsingtheJpGraphlibrarytosendbackimages.html">
|
|
|
8 |
<LINK REL="Next" HREF="44ThebasicprincipleofJpGraphandthecreationofimages.html">
|
|
|
9 |
<STYLE TYPE="text/css"><!--
|
|
|
10 |
BODY { font-family: serif }
|
|
|
11 |
H1 { font-family: sans-serif }
|
|
|
12 |
H2 { font-family: sans-serif }
|
|
|
13 |
H3 { font-family: sans-serif }
|
|
|
14 |
H4 { font-family: sans-serif }
|
|
|
15 |
H5 { font-family: sans-serif }
|
|
|
16 |
H6 { font-family: sans-serif }
|
|
|
17 |
SUB { font-size: smaller }
|
|
|
18 |
SUP { font-size: smaller }
|
|
|
19 |
PRE { font-family: monospace }
|
|
|
20 |
A { text-decoration: none }
|
|
|
21 |
--></STYLE>
|
|
|
22 |
</HEAD>
|
|
|
23 |
<BODY>
|
|
|
24 |
<A HREF="toc.html">Contents</A>
|
|
|
25 |
<A HREF="421UsingtheJpGraphlibrarytosendbackimages.html">Previous</A>
|
|
|
26 |
<A HREF="44ThebasicprincipleofJpGraphandthecreationofimages.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H2><A NAME="4_3">4.3 Using PHP directly</A></H2>
|
|
|
29 |
<P> It is also possible to generate images directly using the command
|
|
|
30 |
line version of PHP. This works the same way as the normal "through the
|
|
|
31 |
browser" generation with the exception that no HTTP headers will be
|
|
|
32 |
generated. Only the binary image data.</P>
|
|
|
33 |
<P> Please make sure that you run the command line version of PHP (cli).
|
|
|
34 |
Using the CGI SAPI version will not work since then the HTTP headers
|
|
|
35 |
will be generated. Note: If the CGI version is used the generation of
|
|
|
36 |
headers may be suppressed by the '-q' option.</P>
|
|
|
37 |
<P> You can easily check the version installed by running</P>
|
|
|
38 |
<PRE>php --version</PRE>
|
|
|
39 |
<P> you should then get a response with something like</P>
|
|
|
40 |
<PRE>
|
|
|
41 |
PHP 4.3.8 (cli) (built: Aug 29 2004 22:48:10)
|
|
|
42 |
Copyright (c) 1997-2004 The PHP Group
|
|
|
43 |
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
|
|
|
44 |
</PRE>
|
|
|
45 |
<P> The important thing here is the</P>
|
|
|
46 |
<PRE>(cli)</PRE>
|
|
|
47 |
<P> marker. The JpGraph library check from what SAPI API it is invoked
|
|
|
48 |
from and adjusts the header generation accordingly.</P>
|
|
|
49 |
<P> If all the above requirements are met then images can be generated
|
|
|
50 |
directly on the command line and stored in a suitable file. For example
|
|
|
51 |
by</P>
|
|
|
52 |
<PRE>
|
|
|
53 |
$> php myimage.php > image.png
|
|
|
54 |
</PRE>
|
|
|
55 |
<P> Please note that the file extension on the image file must match the
|
|
|
56 |
format in which the image is generated.</P>
|
|
|
57 |
<HR NOSHADE>
|
|
|
58 |
<A HREF="toc.html">Contents</A>
|
|
|
59 |
<A HREF="421UsingtheJpGraphlibrarytosendbackimages.html">Previous</A>
|
|
|
60 |
<A HREF="44ThebasicprincipleofJpGraphandthecreationofimages.html">Next</A>
|
|
|
61 |
</BODY>
|
|
|
62 |
</HTML>
|