PHP Text to Image
Change the settings and the click Create
Description
This script is a means to convert a string of text into an image. This has some simple uses such as displaying text such as email address that cannot be programmatically found. This can help to reduce the possibility of your email address being picked up by web crawlers and used for junk mail.
How To Use
To use the example interface above, simply modify or insert the string of text. You can edit any of the other settings, but this is optional.
Further Uses and Ideas:
How it Works:
The PHP Script
contact us for more information
Further Help
For anyone finding problems using this...
(1) Please test this example to ensure imagecreate works on your server...
header("Content-type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
(2) Make sure to use the example at the top of this page by sending POST variables from your form. For example msg,font,size ...
Relevant Links
Previous Comments For This Page
this class has one error with cordinates when i only insert character "a"
By chaunh on 28/07/2010To make it work without the form, you need to change the 'isset lines' to this form:
if (isset($_GET['msg'])) $text->msg = $_GET['msg']; // text to display
On 23/07/2010What about UTF-8 support?
By Canser on 19/07/2010hindi fonts eg mangal.ttf matra gets shifted...
By Devendra singh on 12/07/2010Useless
By Bekaar Hai on 02/07/2010The displayed PNG is quite ugly, and this script needs to be changed to display aliased fonts, to clean up the jagged edges.
On 01/06/2010it is working in localhost but not in server
By subhas on 23/09/2009this doesn't work. all i changed in the script was "default font. directory relative to script directory." to my fonts path directory and added the PHP and ?> to the front/end of the script and it doesn't work. when i run the script i keep getting the default text converted to image "no text". if i type new text in the form fields or change any of the values none of that is changed in the image. its always the "no text" image that comes up.
On 05/06/2009you need to enforce a maximum font size (input value) with php to prevent abuse.
On 28/01/2009Does not seem to work with non-latin text.
By Tael_ on 17/12/2008
Add your own comment below and let others know what you think: