This is a simple way to display your email without fear of it getting picked up by spammers; it creates an image of the email address you send it. To be honest, I don’t think in this day and age spammers spend huge amounts of time trawling through gigs of websites looking for email addresses so all this “howard DOT yeend AT gmail DOT com” stuff I think is largely futile – have you experienced a drop in spam since obfuscating your address like that? Thought not. But hey, if you want to see how to write strings in PHP, check out the code :)
Here’s how it works, in your html source, use this simple code:
<img src=”email.php?text=(base64_encoded email address”>
email.php will generate a png of the right size, with an invisible background.
You can even customise the colour, something like this:
<img src=”email.php?r=100&g=5&b=100&text=(base64_encoded email address)”>
where ‘r’, ‘g’ and ‘b’ are the amounts (0 to 255) of red, green and blue to use.
DEMO:
Here’s my obfuscated email address:



#1 by speedy18us on July 31, 2009 - 10:36 PM
Well man, you got a great blog. i can read it all day and i don’t get borred. for my future projects i will use this php code for emails. i like it.
#2 by Hilton on August 27, 2009 - 2:26 AM
This is great, but people will want this to be clickable so they email directly instead of having to write it down manually as they cannot even copy/paste the text from the png.
Is this sound possible?
#3 by user24 on August 30, 2009 - 11:19 AM
Yes, you’re correct. It’s not possible with this code, but there are javascript email address obfuscators that do what you’re suggesting.