---- createimage.php ----

<?  
if ($_POST['submit'] && $_POST['txt'])  
{      
    echo "<p>Converted image:</p>";
    
    echo "<img src=\"convert.php?txt=" . $_POST['txt'] . "\">";
}
else
{
	echo "<p><b>Convert image:</b></p>";
	
	echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
	echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	echo "<tr><td>";
	echo "<input type=\"text\" name=\"txt\">";
	echo "</td>";
	echo "<td>";
	echo "<input type=\"submit\" name=\"submit\" value=\"convert image\">";
	echo "</td></tr>";
	echo "</table>";
	echo "</form>";
}
?>

---- convert.php ----

<?  
	//-- width & height of img
	$width = strlen($_GET['txt']) * 7;
	$height = 15;
	
	//-- create img
	$txtimg = imagecreate($width, $height);
	
	//-- set fontcolor & bgcolor
	imagecolorallocate($txtimg, 215, 215, 215);
	$txtcolor = imagecolorallocate($txtimg, 0,0,0);
	
	//-- insert text
	imagestring($txtimg, 3, 0, 0, $_GET['txt'], $txtcolor);
	
	//-- send header information
	header("Content-Type: image/png");  
	//-- show img
	imagepng($txtimg);  
	//-- destroy img
	imagedestroy($txtimg);  
?> 