PHP – Converting Strings To Images

One of the most primal needs of displaying strings as an image is during form submission and to make sure that a human being (although there is a finite probability that a monkey can accidentally type the same string correctly) types in the string. This form submission can be to accomplish one of many things – posting comments, placing web orders, displaying email addresses, etc. For my recent, still on-going, attempts to write a personally satisfying photoblog software/application, I need this as part of comment-submission process.

Requirements

It is my practice that I do a full/maximal installation of any linux distribution and that takes care of installing Apache (with all the required modules), PHP, MySQL, ImageMagick, etc. I bet there are tons of documents online that you can refer and install them if you don’t already have them.

SecureImage.php

Let us suppose that all the required code goes into a file called SecureImage.php.


Using This In A Form

Let us suppose that the form looks something like following:

Name (Required)
Email (Required; must be valid; will not be shared or made public)
URL (Optional; please include http://)
Security Phrase (Required; enter the characters shown above)
Comments

APPROPRIATE URL refers to perhaps a PHP script that will process the information submitted by this form.

Screenshot

SecureImage