Home arrow PHP arrow Adding Validation to an Image Generator Class with PHP 5

Adding Validation to an Image Generator Class with PHP 5

Among the plethora of applications that can be developed with PHP 5, building dynamic image streams is one of the easiest to tackle. It requires only an intermediate background in the functions that come packaged with the powerful GD extension. This series of articles will teach you how to use this graphic library to build a highly expansible image generator class that can be used to create noisy images (also known as captchas).

  1. Adding Validation to an Image Generator Class with PHP 5
  2. Recalling the initial definition of the image generator class
  3. Validating incoming parameters
  4. The improved signature of the ImageGenerator class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
October 02, 2007

print this article




Welcome to the second installment of the series that began with "Building a Image Generator Class with PHP 5." In accordance with the series title, these tutorials will guide you through the development of a highly pluggable PHP 5-driven class, which can be useful for embedding dynamically several input strings into a variety of popular graphic formats, including JPG, GIF and PNG.

If you already read the preceding article of the series, I assume that the logic implemented by the image generator class that I developed in that tutorial is now familiar to you. However, to clarify the way this class did its business, let me quickly refresh some key concepts regarding its programmatic functionality.

As you"ll probably recall, the class in question was provided with the ability to create dynamic image streams which contained an embedded text string that was logically passed as an input argument to the class constructor. Also, even though the structure of this class was rather primitive, it was flexible enough to allow us to perform some useful tasks, like displaying on the browser different text strings in a specific graphic format.

Of course, if you analyze the functionality of this image generator class, you might find it rather limited. Nonetheless, it"s possible to couple the class in its current version to other web applications, including banner and noisy images systems.

But, actually I'm getting ahead of myself. In this second part of the series I'll show you how to introduce some important modifications to the initial skeleton of the image generator class, to make it slightly more modular and independent, while maintaining its functionality nearly the same as before. Sounds pretty interesting, right?

So, having already introduced the subject of this second installment of the series, it's time to learn how to modify the original signature of this PHP 5-driven image generator class to improve its overall structure. Are you ready to begin? Let's get started!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: