Change the settings and the click Create
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.
The PHP Script
For anyone finding problems using this...
(1) Please test this example to ensure imagecreate works on your server...
(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 ...
Really amazing, Could you add a background image to the code to upload in the test ? That would be even more amazing!
On 6th September 2019Demo is working fine, but can you provide solution for marathi text that means i copied text from google input tool. eg. %u0935%u0921%u093F%u0932%u093E%u0902%u091A%u093E %u0928%u094B%u0915%u0930%u0940 %u0935%u094D%u092F%u0935%u0938%u093E%u092F
By Anil Choudhari on 24th May 2019how to get utf-8 unicode text to image??
On 9th March 2017Wow, was looking for this. My previous test produced black background when rotated but this one works! big thanks!
By diko on 25th November 2016Not support persian!
By Mohammad Mahdi Naderi on 8th July 2016Works Fine for me but this not complete code for axample - text-shadow, opacity, align, background-color & etc.
By sunil on 10th August 2015hi..how can i add height based on content description? .. moreover your ex code is not working
By gaja on 13th April 2015hey this was awsm solution to my problem. but i m trying some changes in this. i m replacing simple text (hello) with HTML text(<b>hello</b>).
any one have any idea how to implement this
Hi Jeff, we don't want hot-links to the site and wont be able to guarantee they will always work.
By Daft Logic on 25th April 2014Very cool. Any way to create a unique url for the output so I can just link to the image on the fly instead of downloading/uploading the new image every time?
By Jeff on 24th April 2014converte html para png ???
On 27th February 2014Thank you so much. i tried by my self. but it is not work correct. :)
On 6th August 2013Thanks for this class! TIP: The text rendering from GD is ugly, not antialiased. One way to make it look much better is to simply render text at 2x the size you want, then set a height on the <img> tag that is 50% of that (shrinking it back down to the size you really want to display). In Chrome, firefox and recent IE, you'll get a nice, antialiased image of text.
By Jonathan Cross on 2012-11-16
the small example code is working but the big code is not working...can anybody help plz?
By pankaj on 4th June 2012good one
On 5th May 2012Can you give me full example code?
By Raisul on 29th April 2012thank you indeed, I've taken just the example part to build a basic captcha system.
By Luca on 4th April 2012Duh people!!!
Replace the
header("Content-type: image/png");
with this:
$i = new textPNG;
$i->msg = "Your text here!!!";
header("Content-type: image/png");
$i->draw();
And you have a perfect script.
text quality is bad
By ali on 29th November 2011Not support utf-8 character ! :(
By GaRic on 13th November 201120 out of 50 comments shown.
There's no need to create an account or provide unnecessary details. Just your comment.