Text to Image converter php script Protect Email ID

Hi there, I did this project 1 year back and the first article about this script was in bangle. Today I will write that into English.  I prepared that script as I have a site where I need to share email ID. But text email id is very attractive element for the email marketer! They just search @ sign and grab email ids! That's why I thought I need email id as an image.

Anyway, let's began. What I am gonna say is about a php script that will convert text into image and you may use it to print email on your site same like me. Well, Demo and Download link of the script is as follows

Text to Image php Script Demo and Download Page

Now we will see the codes step by step. First create a new php file on your server give the name image.php, you are free to chose other name also. It's totally up to you. And on that new file, copy the following code


header ("Content-type: image/png");
$string = $_GET['img'];                                            
$font   = 4;
$width  = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font)+2;
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, 0, 0,  $string, $text_color);
imagepng ($im);

The above line of code will get text in get method and convert in into Image. And now open another  file (may be index.php or txt2img.php ) and put the below code. Continue reading Text to Image converter php script Protect Email ID