On Nov 16, 2010, at 5:25 PM, Daniel P. Brown wrote: > On Tue, Nov 16, 2010 at 16:29, ash@xxxxxxxxxxxxxxxxxxxx > <ash@xxxxxxxxxxxxxxxxxxxx> wrote: >> Sorry for top post on phone. >> >> Depending on the type of site and location an email address might be legally required. For example, a business website in the UK requires a value email address to be made accessible to all your visitors, which includes blind people, so no image-only addresses. >> >> Spam is just a fact of life now, and the only real method of protection is a decent spam filter. > > > <?php > > /** > * Just hacked this together for your usage now. It's > * a very basic implementation of a graphical display > * of an email address (or any text, for that matter). > * This can still easily be picked up by harvesters that > * employ OCR, but beggars cannot be choosers. Well, > * they can, but they really shouldn't. I mean, seriously, > * there they are, just hoping and praying for a handout, > * and when it finally comes, they bitch and moan that > * I don't have any apples that didn't fall into the > * sewer and sit there for a week that one time I donated > * food to the food kitchen because I wanted this girl > * to like me but it turned out she was a lesbian so > * I just wasted the gas in the first place and my > * car smelled like homeless people and crap-flavored > * apples for three weeks. > */ > function drawEmail($email) { > > /** > * Set the width/height of the image. > */ > $im = imagecreate(220,20); > > /** > * Define the colors to be used, using RGB values. > */ > $black = imagecolorallocate($im,0,0,0); > $white = imagecolorallocate($im,255,255,255); > > /** > * Fill the image with a chosen color. > */ > imagefill($im,0,0,$white); > > /** > * Calculate the text size to be used. > */ > $px = (((imagesx($im) - 7.5) * strlen($string)) / 2); > > /** > * Write $email in calculated size with chosen color. > */ > imagestring($im,3,$px,9,$email,$black); > > /** > * Output the image. > */ > header("Content-type: image/png"); > imagepng($im); > > /** > * Garbage clean-up, pass-through the status bool. > */ > return imagedestroy($im); > } > > drawEmail('danbrown@xxxxxxx'); > > ?> This approach uses javascript and can only be harvested if the harvesters fully render and implement javascript which I have yet to hear of. Put in a js file: /* Scripts to render and address */ <script language="JavaScript" > function display_email(name,domain) { //U+0040 @â commercial at (64decimal, HTML: @) document.write(name + '\x40' + domain); } function echo_mailto(name,domain,subj,italics) { document.write('<a href="mailto:'); display_email(name,domain); if (subj) { document.write('?subject=' + subj); } document.write('">') if (italics) { document.write('<i>'); } display_email(name,domain); if (italics) { document.write('</i>'); } document.write('</a>'); } </script> To use: <?php echo "<script language=\"JavaScript\">echo_mailto('$yourname','$yourdomain','Feedback',true);</script>"; ?> which displays in italics an active mailto link to yourname@yourdomain This is not harvestable unless a harvester renders javascript which I have yet to hear of and it meets Ash's comment about legal requirements. I would reco to add in a spam trap or two to every page and forward them to spam harvesters. Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php