This is article is an excerpt of chapter
12 of “Dreamweaver MX: Advanced
PHP Web Development” by Gareth
Downes-Powell, Tim Green, Allan
Kent, Bruno Mairlot, George McLachlan,
Dan Radigan, published January
2003 by glasshaus,
isbn 1904151191, as part of the dreamweaver
pro series. All rights reserved.
At this point I'm sure you're convinced
that PHP is a very powerful language
to generate all sorts of text content
on a web page. In this chapter, we
are going to look at how PHP can create
non-textual dynamic content: graphics.
We'll start off with a short discussion
of image formats and their relative
merits. We'll also look at the basic
constructs of HTML and how they are
used in conjunction with static images.
Next we'll take a short look at the
way images are transferred over HTTP
and the different methods that we can
output graphical content from PHP.
The function library for image
manipulation in PHP is quite extensive.
We'll take a short tour of the
most important tools for server-side
graphics creation rather than an
exhaustive look at each of the
functions in detail.
We'll then take that core set of functions
to create some practical examples seen
in many web pages. First we start off
with building a dynamic button, one
that we can use in a navigational toolbar.
We then move on to two implementations
of a counter, one using a dynamic image
and another using a collection of static
ones, comparing and contrasting the
approaches. We finish with creating
a chart bound to data from a MySQL
database. We'll turn that functionality
into a Server Behavior for reusability
in other applications.
Much of the content in this chapter
relies on concepts previously explained
in earlier chapters. Beyond a basic
mastery of PHP, we'll be using several
concepts from other chapters, mainly
from Chapter 4, and Chapter 6. While
by no means required, having read and
mastered the other material will make
the concepts in this chapter clearer.
|