1 2 <?php 3 4 if(empty($_GET['sid'])){ 5 //write html for image 6 $mail='example@domain.com'; 7 $text=base64_encode(serialize($mail)); 8 echo '<img src="imgmail.php?sid='.$text.'" /><br/>'; 9 }else{ 10 //show coded mail image 11 $text=$_GET['sid']; 12 header("Content-type: image/gif"); 13 echo mail_to_image($text); 14 } 15 16 function mail_to_image($ctext='no mail'){ 17 $text=unserialize(base64_decode($ctext)); 18 $size=strlen($text)*8; 19 $im = @imagecreate($size, 20) or die("Cannot Initialize new GD image stream"); 20 $background_color = imagecolorallocate($im, 255, 255, 255); 21 $text_color = imagecolorallocate($im, 0, 0, 0); 22 imagestring($im,3, 5, 5, $text , $text_color); 23 return imagegif($im); 24 } 25 ?>
You need to create an account or log in to post comments to this site.
1 page example