Image Generation on the FLY using PHP

Introduction

PHP, or PHP Hypertext Pre-processor, is one of the most popular scripting languages available to web developers. There are many reasons why PHP is now the most popular server-side scripting language for the Apache web server. Firstly, it supports database connectivity to a huge number of popular vendors, including Microsoft, Oracle and IBM. Secondly, with the correct libraries installed, PHP also supports real-time generation of images, PDF files, and even shockwave movie files! The only limit that bounds us when we’re developing with PHP is our imagination.

For developers like myself, one of the most popular features of PHP is real-time image generation. That is, we can create a new image canvas, “paint” it, and either save it to a file, or send it directly to the browser. In this article, I will show you how to create an image in real-time with PHP. The image will be similar to the ones used on yahoo.com and paypal.com, where a random number is generated inside of an image. That image is displayed in the browser, and you have to enter that random number into a text box to create a new account. This is a method that is becoming more popular, and it’s used to stop people from generating multiple user accounts in one go, which, is some cases, can crash the web server(s).

You might also like...

Comments

About the author

Divyesh Jariwala India

A fellow who believes in simple things, simple way.

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.”