| 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="31Preparation.html">
|
|
|
8 |
<LINK REL="Next" HREF="312VerifyingthatyouhaveGD2installed.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="31Preparation.html">Previous</A>
|
|
|
26 |
<A HREF="312VerifyingthatyouhaveGD2installed.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="3_1_1">3.1.1 Verifying that you have the GD library
|
|
|
29 |
installed</A></H3>
|
|
|
30 |
<P> In order to make sure that the GD installed the following example
|
|
|
31 |
would be run. The example creates a very simple image using just pure
|
|
|
32 |
GD calls and outputs an image in PNG format. This could be considered a
|
|
|
33 |
smoke-test to see that the GD library is available from PHP. Please
|
|
|
34 |
note that this is an<B> absolute</B> pre-requisite in order for the
|
|
|
35 |
JpGraph library to work at all.</P>
|
|
|
36 |
<P> Store the code snippet below somewhere in the document root and make
|
|
|
37 |
sure it runs correctly.<DIV class="phpscript"><CODE><FONT color="#000000">
|
|
|
38 |
<FONT color="#0000BB"> $im </FONT><FONT color="#007700">= @</FONT><FONT color="#0000BB">
|
|
|
39 |
ImageCreate </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
40 |
150</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">100</FONT><FONT
|
|
|
41 |
color="#007700">)
|
|
|
42 |
<BR> or die (</FONT><FONT color="#DD0000">
|
|
|
43 |
"Cannot create a new GD image."</FONT><FONT color="#007700">);
|
|
|
44 |
<BR></FONT><FONT color="#0000BB">$background_color </FONT><FONT color="#007700">
|
|
|
45 |
= </FONT><FONT color="#0000BB">ImageColorAllocate </FONT><FONT color="#007700">
|
|
|
46 |
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
47 |
color="#0000BB">255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
48 |
255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT
|
|
|
49 |
color="#007700">);
|
|
|
50 |
<BR></FONT><FONT color="#0000BB">$text_color </FONT><FONT color="#007700">
|
|
|
51 |
= </FONT><FONT color="#0000BB">ImageColorAllocate </FONT><FONT color="#007700">
|
|
|
52 |
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
53 |
color="#0000BB">233</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
54 |
14</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">91</FONT><FONT
|
|
|
55 |
color="#007700">);
|
|
|
56 |
<BR></FONT><FONT color="#0000BB">ImageString </FONT><FONT color="#007700">
|
|
|
57 |
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
58 |
color="#0000BB">1</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
59 |
5</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">5</FONT><FONT
|
|
|
60 |
color="#007700">, </FONT><FONT color="#DD0000">"A Simple Text String"</FONT><FONT
|
|
|
61 |
color="#007700">, </FONT><FONT color="#0000BB">$text_color</FONT><FONT color="#007700">
|
|
|
62 |
);
|
|
|
63 |
<BR></FONT><FONT color="#0000BB">header </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
64 |
color="#DD0000">"Content-type: image/png"</FONT><FONT color="#007700">);
|
|
|
65 |
<BR></FONT><FONT color="#0000BB">ImagePng </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
66 |
color="#0000BB">$im</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB">
|
|
|
67 |
</FONT></FONT></CODE></DIV></P>
|
|
|
68 |
<P> If the above script does not work or some error or warnings are
|
|
|
69 |
printed on the screen then it is necessary to correct those problems
|
|
|
70 |
before proceeding with the installation.</P>
|
|
|
71 |
<HR NOSHADE>
|
|
|
72 |
<A HREF="toc.html">Contents</A>
|
|
|
73 |
<A HREF="31Preparation.html">Previous</A>
|
|
|
74 |
<A HREF="312VerifyingthatyouhaveGD2installed.html">Next</A>
|
|
|
75 |
</BODY>
|
|
|
76 |
</HTML>
|