Accessibility
 
Home / Developer Center / Dreamweaver Developer Center /

Dreamweaver Article

Icon or Spacer Icon or Spacer Icon or Spacer
Dreamweaver MX: Advanced PHP Web Development

Dan Radigan
Macromedia


 
PHP Server-Side Graphics in Dreamweaver MX


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.

 
Table of Contents
Graphics Basics
Graphics Manipulation with PHP
The GD API—The Basic Functions
The GD API—Working with Color
The GD API—Creating Primitive Shapes
The GD API—Working with Text
Using GD in Applications—Creating a Dynamic Button
Using GD in Applications—A GD-Based Page Counter
Graphical Page Counter—Without GD
Creating Dynamic Charts
Integration with Dreamweaver MX
 
  Next

About the Author
Dan Radigan works as Quality Assurance Lead at Macromedia on the Dreamweaver Team. He graduated Georgia Tech with a computer Science Degree. He lead the design of the PHP server technology in Dreamweaver MX. He's been using PHP since version 3.0 and spends about equal time between the Windows, Macintosh, and Linux builds of PHP. When not working with PHP, Dan enjoys camping, hiking, and motorcycling up in the Sierra Nevada Mountains of Northern California.