That Software Guy, Inc.'s Logo

Software Consulting Services
Need Help? Call That Software Guy!


RatePoint Site Seal

Sign up for That Software Guy, Inc.'s Zen Cart Newsletter. You'll get periodic updates on new features I'm developing.
Email:
Preferred format:
HTML   Text

Email Address Cloaking Example



Email address cloaking is a way to present email addresses while making them harder for spammers to harvest.

Create a file called "email_to_image.php" with the following code:

<?php
// Tell the browser you're sending an image
Header("Content-Type: image/png");

// Grab the email from your form.
$email = $_REQUEST['email'];

// Create a thin, wide image.
$im = ImageCreate(800, 20);

// Use black text on white background
$backgroundcolor = ImageColorAllocate($im, 255, 255, 255);
$textcolor = ImageColorAllocate($im, 0, 0, 0);

// Fill with backgroundcolor
ImageFill($im, 0, 0, $backgroundcolor);

// Write out the string
ImageString($im, 5, 5, 3, $email, $textcolor);

// output straight to browser.
ImagePNG($im);
ImageDestroy($im);
?>


Then from the just call email_to_image with the email address you want. This example is in a form within a table:

<tr>
<td><div align="right">Verification Code:</div></td>
<td><img src="email_to_image.php?email=bill.gates@microsoft.com"
align="left" alt="email" /></td>
</tr>
   Terms | Privacy | SiteMap | Newsletter | Contact Me | ©2003-2008 That Software Guy, Inc.