I'm coding a site that shows users' advertisements. To prevent email harvesting scripts from swiping advertisers' email addresses, I put together some code that turns them into images.
I do it by having this separate script ("convert.php:"):
$email = $_GET['m'];
$email = base64_decode($email);
$font = 2;
$im = imagecreate(imagefontwidth($font)*strlen($email),imagefontheight($font));
$textcolor = imagecolorallocate($im, 0, 66, 255);
$fill = imagecolorallocate($im, 254, 244, 156);
imagefill($im,0,0,$fill);
imagestring($im, $font,0,0,$email,$textcolor);
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
And on the ad page, I show the "email image" by:
$EncodedEmail = base64_encode($EmailAddress);
echo '<img src="convert.php?m='.$EncodedEmail.' alt="" />';
There are 12 ads per page. It all works fine, but now I'm wondering if this is too much processing for the server? Or should it be it OK?