Avataree is a gem to make your project/app deal with Gravatar services for profile and images in a simplified ruby manner.

Installation

first you need to create a dependency in your Gemfile

gem 'avataree'

then let your bundle handle everything.

bundle install        

and avataree will be at your service.

Uses

In your controller for fetching gravatar image

gravatar(you@email.com)

for fetching gravatar profile

gravatar_profile(you@email.com)    

In addition to that avataree provides all options available/provided by Gravatar services.

Here are the details

Size:

options :s or :size, default 80px X 80px example:

gravatar(you@email.com, :size => 100)

Default Image:

If there is no image fount associated with email provided then Gravatar returns default image. A 90 degree tilted G. But you can customize it further with providing values for options :d or :default example:

gravatar(you@email.com, :default => "mm")

values accepted by gravatar are:

404: returns an HTTP 404 (File Not Found) response
mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)
identicon: returns a geometric pattern based on an email hash
monsterid: returns a generated monster with different colors, faces, etc
wavatar: returns generated faces with differing features and backgrounds
retro: returns generated, 8-bit arcade-style pixelated faces

Instead of that you can have your own default image by providing it’s URL (Note: url should be encoded to be carried away smoothly).

In addition to that you can always force gravatar to return default image by providing :f or :force default option.

Related Links (For further details)
Documentation
Source

Credits Credit for this gem goes to Gravatar team for making such a awesome application.


About The Author

I am Pankaj Baagwan, a System Design Architect. A Computer Scientist by heart, process enthusiast, and open source author/contributor/writer. Advocates Karma. Love working with cutting edge, fascinating, open source technologies.

  • To consult Pankaj Bagwan on System Design, Cyber Security and Application Development, SEO and SMO, please reach out at me[at]bagwanpankaj[dot]com

  • For promotion/advertisement of your services and products on this blog, please reach out at me[at]bagwanpankaj[dot]com

Stay tuned <3. Signing off for RAAM