Wed 5th Oct 2005
Another Gravatar Implementation
Posted late afternoon, filed under Blogsome , JavaScript.I recalled at some stage there was a Smarty Modifier called escape. I think it was when I was looking for one called rot13.
Anyways, you can use this and the JavaScript function unescape() to obfuscate the email address.
You’ll need this code early in your template: I stick it at the start just after <html>
<script type="text/javascript"
src="http://schinckel.blogsome.com/images/md5.jpg">
</script>
This fragment will insert the Gravatar Image:
{capture name=reader}{comment_author_email}{/capture} <script type="text/javascript"> document.write('<div class="right">'); document.write('<img src="http://www.gravatar.com/avatar.php?gravatar_id='); document.write(hex_md5(unescape("{$smarty.capture.reader|escape:"hex"}"))); document.write('&size=40" alt="" />'); document.write('</div>'); </script>
This seems to more reliably display the Gravatars, so I’d suggest you use it instead. Either that, or Gravatar just fixed up their servers…
You’ve got a bit of a problem now with your comment preview. I’m not certain if it’s just a one time glitch, but in your preview it’s looking like:
On
{$smarty.now}AbandonedHero said:1 day, 10 hours after the fact.
Yeah, I was halfway through rejigging some stuff and I went to bed.
Must fix that!.
Thanks.
1 day, 17 hours after the fact.