Note: this post is now out of date. Go to Gravatars in Blogsome instead.
I did get Gravatars working in Blogsome to some extent a while ago, but it exposed the email addresses.
What I’ve done now is obscure the email addresses, and it should be safe to use:
<script type="text/javascript">
{capture name=reader}{comment_author_email}{/capture}
var ob_email = "{$smarty.capture.reader|replace:'@':';'}";
var email = ob_email.replace(/;/g,"@");
document.write('<div class="right"><img src="http://www.gravatar.com/avatar.php?gravatar_id=');
document.write(hex_md5(email));
document.write('&size=50" /><\/div>');
</script>
Basically, it grabs the Commenter’s email address, and changes it in Smarty from email@domain.com to email;domain.com - then JavaScript is used to change it back before passing to the hex_md5(); function.
You will need to have the following code inserted in your template somewhere before this:
<script type="text/javascript" src="/images/md5.jpg"></script>
And the file md5.jpg stored on your server, or the following line (using the copy on my server):
<script type="text/javascript" src="http://schinckel.blogsome.com/images/md5.jpg"></script>
If you download my version, clicking on the links won’t work: you’ll need to right-click and choose Save…
Thanks for figuring this out, but I have a question. I can’t get it so it’s like yours. Mine has the comment on one line and the gravitar on the next. Is there any way you can help? Thanks.
3 days, 22 hours after the fact.
Jake: I use a
<div class='right'>around the gravatar object, and then in my CSS I have the following:.left{float:left;
}
.right{
float:right;
}
1 week, 3 days after the fact.
Thank you, I used this in my blog. I also trackback this posting. But there is a problem. How to display my gravatar instead of blank gravatar? this happen if the author don’t have gravatar
Thanks
5 months, 2 weeks after the fact.
There is a better solution to this, see: Gravatars in Blogsome.
5 months, 2 weeks after the fact.