twitterlink facebooklink feedlink

April 10, 2010: This afternoon I recieved a visit from a plushy black cat. I've never seen her before and since she has a collar she may be moved in with her owner in the last days.

Read more about project 365 ...

A gravatar plugin for mephisto

Posted by semantosoph on Jul 31, 2009 | 2 comments

Although the mephisto blog system contains a possibility to display a gravatar for a specific comment, I decided to do my own gravatar plugin, because I wanted to display gravatars not just on comments. You can download the first version from GitHub.

Installation

Installation is real simple. Just download it and put it into your vendor/plugins folder. After that, restart your server.

Options

You may configure the following options in lib/mephisto_gravatar_plugin.rb:

default = 'identicon'

The guys at gravatar.com offer you three default avatars, in case there is no gravatar associated with that email address. Correct values for would be identicon, monsterid and wavatar.

rating = 'pg'

As you may know, all gravatars include a rating, done by the holder of the email. This rating may be one of the following: g, pg, r or x. To get only the gravatars you want, set the correct rating.

Usage

You can stuff any email into the filter, in order to get its gravatar. Sample usages:

{{ article.author.email | get_gravatar }}
{{ comment.author_email | get_gravatar, 30 }}

Note the object independence. An email address is all you need. You may deliver the desired size as an option to the filter. Leaving that out brings up the standard size of 80×80px.

There is still work to do. I think about pre-caching all gravatars for the registered bloggers. But that is subject to later exploration.

Gravatar image Tong Kosong wrote on August 24, 2009

thanks for this nice info, it’s so useful for me.

regards, Tong Kosong

Gravatar image Sven wrote on August 26, 2009

I am very pleased to hear that I could help you.

Cheers, Sven

Post your comment

Filed under , , , ,