The GD graphics library is available from www.boutell.com/gd/. Depending on your UNIX distribution, any upgrades you may have installed, and the current version, various functions may be available and others unavailable. For example, versions prior to 1.3 containing GIF support may either have proprietary LZW-based GIF compression or PNG-only support due to licensing issues. Versions 1.3 and above contain non-LZW-based GIF compression code, which creates slightly larger files, as well as PNG support. Further up the version chain, version 1.5 contains a GD2 format using zlib, while GIF support was removed again in version 1.6. JPEG support was added with version 1.8. Fortunately, the phpinfo() function includes the version of GD that PHP was linked against, so you can deduce which functions are available. You'll also need to install libpng, libjpg, and the Freetype library to make non-GIF functions available. Remember that if you send the image to the browser, you must also send a Content-type HTTP header. For example, to send a header for a GIF file, the correct function call would be header("Content-type: image/gif")() . Please note that the origin of pixel coordinates is the upper-left corner of the image.
Table of Contents
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.