HomePHP Creating Image Streams from Existing Graphics with the GD Library in PHP
Creating Image Streams from Existing Graphics with the GD Library in PHP
Within the huge range of applications that can be developed with PHP, creating dynamic images may be among the most useful and interesting. This process can be easily tackled by using the GD library. If you're curious about how to use the functions that come bundled with this extension, this series of articles might be what you're looking for.
Welcome to the second installment of the series that began with "A Close Look at the GD Library in PHP." This series steps you through creating and processing dynamic images with this powerful PHP extension, and it shows you how to use its most relevant functions with numerous practical examples.
Now, reviewing the group of topics discussed in the previous article, hopefully you'll recall that the GD extension can be remarkably useful when it's necessary to generate image streams from scratch. With regard to this process, this extension provides PHP developers with the intuitive "imagecreate()", "imagecreatetruecolor()" and "imagecolorallocate()" functions. When used in conjunction, these functions make building dynamic graphics a truly painless procedure.
The GD library presents some other useful functions as well, like the popular "createimagefromgif()" for building image streams from existing GIF graphics. This function can be quite helpful if your PHP applications demand some kind of preprocessing on certain background images.
So far, so good right? At this stage, hopefully all of the GD functions that I mentioned above should be quite familiar to you, since they're very easy to grasp and use in the context of any PHP application. However, as I stated at the end of the previous article of this series, the GD extension comes packaged with many other useful functions, which indeed deserve a close and detailed look.
Thus, in this second tutorial I'll show you how to create different types of image streams from existing graphics, but in this case limiting the process to building GIF, JPG and PNG images.
Now, having introduced the topics that I plan to discuss, let's continue exploring the functions that come bundled with the GD library. Let's get going!