Image Gravatar

A simple plugin adding the img_gravatar image link helper to ActionViews.

Install

gem install tsalzer-img_gravatar --source http://gems.github.com

What is a Gravatar?

A gravatar is a globally recognized avatar. It is an image hosted on the site site.gravatar.com, uploaded by the user and referred to on base of an eMail address. News on gravatar can be found at blog.gravatar.com.

Each gravatar image can be rated with respect to its content being suiteable to audience.

Usage

To use a gravatar on your system, your view needs the eMail address of the individual to be displayed. The most simple case is like this:

<p>
  <%= img_gravatar('[email protected]') %> That's me.
</p>

This will render the image of the person known under the eMail [email protected] in your browser. If there is no person known with this name, it will render the Gravatar logo.

A more complex szenario would include a size definition, and an alt image tag:

<p>
  <%= img_gravetar('[email protected]', { :size => 40, :alt => "That's me." }) %>
</p>

This would render a downsized image of 40x40 with the alt-tag “That’s me.”.

For a complete description of available parameters see Gravatar::InstanceMethods#gravatar in the Gravatar::InstanceMethods.

Configuration Options

You can modify the following aspects of the displayed gravatar image:

* :alt          - the alternative text for this image
* :default_url  - the default URL for this gravatar
* :size         - the requested gravatar size
* :rating       - the requested maximum rating

Building a new Gem

To create a new gem, you need to install the echoe gem (see blog.evanweaver.com/files/doc/fauna/echoe/files/README.html). Next, edit the Rakefile to reflect your changes, then run:

rake clobber        # remove generated stuff for a clean manifest
rake manifest       # only needed if you changed the file set
rake build_gemspec  # update the gemspec

Now, you can either publish the gem, or build a gem package. See rake -T for available targets.

License

The img_gravatar gem comes to you under the MIT License. You should find the license text in the file MIT-LICENSE in the gem folder.

The img_gravatar gem is not affiliated with the Gravatar service. Usage terms of the Gravatar service should be looked up at gravatar.com.

Please note that changes to the Gravatar API or their terms of service or the cease of Gravatar service may result in breaking the img_gravatar gem functionality. This is considered out of the responsibility of the author of the img_gravatar gem.