Simple script to convert a string (such as an email addresses) to a transparent image.
Usage:
<img src="stringtoimg.php?string=<?= urlencode(base64_encode($email)) ?>">
From a spambot's point of view, they see:
<img src="stringtoimg.php?string=ZpbXZG92ZXJsb3JkQGdtYWlsLmNvbQ%3D%3D">
Optional parameters:
font_size: 1 to 5, with the default at 3
R/G/B: the font color, in hex.
Usage:
<img src="stringtoimg.php?string=<?= urlencode(base64_encode($email)) ?>&font_size=4&R=FF&G=FF&B=00">
<?php
header ("Content-type: image/png");
$font_size = isset($_GET['font_size']) ? $_GET['font_size'] : 3;
$string = urldecode(base64_decode($_GET['string']));
$width = imagefontwidth($font_size) * strlen($string);
$height = imagefontheight($font_size);
$img = @imagecreatetruecolor($width, $height)
or die("Cannot Initialize new GD image stream");
imagesavealpha($img, true);
$trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefill($img, 0, 0, $trans_colour);
$text_color = isset($_GET['R'], $_GET['G'], $_GET['B']) ?
imagecolorallocate($img, hexdec($_GET['R']), hexdec($_GET['G']), hexdec($_GET['B'])) :
imagecolorallocate($img, 0, 0, 0);
imagestring($img, $font_size, 0, 0, $string, $text_color);
imagepng($img);
imagedestroy($img);
?>