On Tue, 2010-11-16 at 17:37 -0500, TR Shaw wrote: > 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 As it uses Javascript, it also poses a bit of a problem for anyone without Javascript enabled, which is any of: * Anyone who has turned it off * Anyone behind a firewall that removes Javascript (which people might not have access to) * Mobile users who don't have the latest and greatest phones but still have web access * People using a browser that doesn't understand Javascript (speech or Braille browsers maybe?) Also, seeing as how even Google can run Javascript through it's spider, which is shown by the screenshots it's added to the search results, it is probably just a matter of time before the spammers use this technique; after all, computing equipment is cheaper and faster every day. I must admit, I do use the Javascript version on my own site (which I'll be changing once I get round to re-doing my site), which is fine for a personal site, but if it's a company website, then there really isn't any excuse, as a working email address has to be displayed along with other company information by law. This may not be a business website, but the whole thing is worth considering. Thanks, Ash http://www.ashleysheridan.co.uk