In one of the previous posts about CAPTCHA Image Generation we made use of PHP’s image generation functions but didn’t discuss about them. So, if you had any problems or just want to know more, read on. Creating and outputting images from PHP is very simple and easy. And since PHP supports images in a number of different formats you can very easily generate images in various formats such as JPEG, PNG, GIF etc. Generating images involves the following steps: Creating a canvas. Drawing Outputting the image. Now, let’s look at each of the steps in detail. Creating a Canvas Creating a canvas is very easy, just use the following function: resource ImageCreateTrueColor ( int $width , int $height ) The capitalization doesn’t matter as with any function in PHP. If you want your canvas to have some background color (default is black) you can use the following function: bool ImageFill ( resource $image , int $x , int $y , int $color ) Where color is t
A resource for learning PHP, HTML, CSS, JavaScript, C++, etc.