Main Page
 The gatekeeper of reality is
 quantified imagination.

Stay notified when site changes by adding your email address:

Your Email:

Bookmark and Share
Email Notification
Project Image
The purpose of this tutorial is to show how to create a simple image with PHP (this was done on Ubuntu 12x with PHP 5x). As you can see, it is pretty easy to do with text (which may be angled, etc). While not shown here, you have a myriad of other capabilities (like drawing lines and other shapes).

$txtdisplay = "hello";
$fontsize = 3; /* 1-5 built-in Latin 2 encoded font, where 5 is the biggest */
$width = imagefontwidth($fontsize) * strlen($txtdisplay);
$height = imagefontheight($fontsize);
$image = imagecreate($width, $height);
if ($image) {
$image_bgcolor = imagecolorallocate($image, 255, 255, 255);
$image_txtcolor = imagecolorallocate($image, 0, 0, 0);
imagefilledrectangle($image, 0, 0, $width, $height, $image_bgcolor);
imagestring($image, $fontsize, 0, 0, $txtdisplay, $image_txtcolor);
header("Content-type: image/png");
else {
/* The image could not be generated */

About Joe