WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides Click here to Update Your Picture
Christian Haensel
Date : Jun 14th 2007
Grade : 3 of 5 (graded 5 times)
Viewed : 11703
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Christian Haensel
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

This little script will output any given email address (or other text string) as an image, so it won't be seen as an email address by bots.

This is just a very basic script, but it does its job.

Call it like <img src="scriptname.php">

Cheerio !

Chris
<?php
header
("Content-type: image/png");
// Your email address which will be shown in the image
$email    =    "you@yourdomain.com";
$length    =    (strlen($email)*8);
$im = @ImageCreate ($length, 20)
     or die (
"Kann keinen neuen GD-Bild-Stream erzeugen");
$background_color = ImageColorAllocate ($im, 255, 255, 255); // White: 255,255,255
$text_color = ImageColorAllocate ($im, 55, 103, 122);
imagestring($im, 3,5,2,$email, $text_color);
imagepng ($im);
?>



Advanced Image WaterMarker
Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented
Line graphics generation library written in PHP + GD library (spanish comments)
Categories : PHP, Graphics, GD image library
Simple PHP Bar Graph using GD library
Categories : PHP, GD image library, Graphics, Arrays
Image Generation Class ( PNG Format )
Categories : PHP, GD image library, PHP Classes, Graphics
PHP Image Compression using GD library
Categories : PHP, Compression, GD image library, Graphics
a simple pie-chart in php3 (with gd)
Categories : PHP, Graphics, GD image library, Charts and Graphs
A captcha image allows you to prevent spam posting when users reload the page and stop bots from submitting forms automatically. This version allows you to use your own fonts (.ttf) to show the text.
Categories : PHP, Security, Graphics, GD image library
Simple image counter
Categories : PHP, Graphics, Filesystem, Beginner Guides
Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics
CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions
imageMarker v 3.00 with new advanced features
Categories : PHP, PHP Classes, Graphics, GD image library
PHP Image Validation Class - test if a specific file is of a certain image type without relying on the said file extension.
Categories : PHP, PHP Classes, Data Validation, Graphics, Beginner Guides
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
 Brooke Dukes wrote :1869
I took your code and made it more dynamic by dynamically creating the E-mail address based on the url. 

<?php 
header
("Content-type: image/png");
// Your email address which will be shown in the image
$user $_GET[u];
$domain $_GET[d];
$suffix =  $_GET[s];
$email    =    $user "@" $domain "." $suffix
$length    =    (strlen($email)*8);
$im = @ImageCreate ($length20)
     or die (
"Kann keinen neuen GD-Bild-Stream erzeugen");
$background_color ImageColorAllocate ($im255255255); // White: 255,255,255
$text_color ImageColorAllocate ($im55103122);
imagestring($im3,5,2,$email$text_color);
imagepng ($im);
?>

then call it using myscript.php?u=user&d=example&s=com

Just a thought, and would be helpful when using this script for multiple e-mail addresses on the same page.