Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="31Preparation.html"><LINK REL="Next" HREF="312VerifyingthatyouhaveGD2installed.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="31Preparation.html">Previous</A><A HREF="312VerifyingthatyouhaveGD2installed.html">Next</A><HR NOSHADE><H3><A NAME="3_1_1">3.1.1 Verifying that you have the GD libraryinstalled</A></H3><P> In order to make sure that the GD installed the following examplewould be run. The example creates a very simple image using just pureGD calls and outputs an image in PNG format. This could be considered asmoke-test to see that the GD library is available from PHP. Pleasenote that this is an<B> absolute</B> pre-requisite in order for theJpGraph library to work at all.</P><P> Store the code snippet below somewhere in the document root and makesure it runs correctly.<DIV class="phpscript"><CODE><FONT color="#000000"><FONT color="#0000BB"> $im </FONT><FONT color="#007700">= @</FONT><FONT color="#0000BB">ImageCreate </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">150</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">100</FONT><FONTcolor="#007700">)<BR> or die (</FONT><FONT color="#DD0000">"Cannot create a new GD image."</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$background_color </FONT><FONT color="#007700">= </FONT><FONT color="#0000BB">ImageColorAllocate </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONTcolor="#0000BB">255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONTcolor="#007700">);<BR></FONT><FONT color="#0000BB">$text_color </FONT><FONT color="#007700">= </FONT><FONT color="#0000BB">ImageColorAllocate </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONTcolor="#0000BB">233</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">14</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">91</FONT><FONTcolor="#007700">);<BR></FONT><FONT color="#0000BB">ImageString </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONTcolor="#0000BB">1</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">5</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">5</FONT><FONTcolor="#007700">, </FONT><FONT color="#DD0000">"A Simple Text String"</FONT><FONTcolor="#007700">, </FONT><FONT color="#0000BB">$text_color</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">header </FONT><FONT color="#007700">(</FONT><FONTcolor="#DD0000">"Content-type: image/png"</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">ImagePng </FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$im</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> If the above script does not work or some error or warnings areprinted on the screen then it is necessary to correct those problemsbefore proceeding with the installation.</P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="31Preparation.html">Previous</A><A HREF="312VerifyingthatyouhaveGD2installed.html">Next</A></BODY></HTML>