Friday, December 2, 2011 Integrating Gravatar with your blog
Today I integrated Gravatar with my blog so, for commenters who have a Gravatar account, you'll now see an avatar next to their blog post comments.
As long as you have a commenter's email address it's very easy to display their avatar.
In Coldfusion simply convert the commenter's email address to lower case, hash it, convert it to lower case again and add it to an IMG tag as follows.
When uploading an avatar to the Gravatar web site you are required to apply a rating to it.
- G rated: suitable for display on all websites with any audience type.
- PG rated: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
- R rated: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
- X rated: may contain hardcore sexual imagery or extremely disturbing violence.
To ensure X rated avatars do not appear on your site simple append ?r=R to the URL like so:
Now only avatars that are R rated and below will be displayed.
Finally, if the commenter does not have a Gravatar account a placeholder image is displayed. You can override the default image and display one of your own by appending an image URL like so:
Monday, December 5, 2011 Raymond Camden
I've often wondered - are there actually X rated Gravatar images?
Monday, December 5, 2011 Simon Bingham
The mind boggles! :)
Monday, December 12, 2011 Lola J. Lee Beno
Yeah . . . what Ray asked.