1. Nicolas Cavigneaux
  2. gravatar

Wiki

Clone wiki

gravatar / Home

Gravatar

Gravatar is a Javascript script to retrieve email associated gravatar picture or profile. It requires MooTools >= 1.2.

Features

Gravatar features are:

  • Dead simple to use
  • Use user email MD5 for privacy
  • Can use plain clear email if you don't care about privacy
  • Creates multiple instances
  • Fully customizable
  • Works on Safari, Firefox, IE 6/7, Chrome and Opera
  • Documentation generated with PDoc
  • Open source, full code is available on BitBucket

Download

  • Full code is available from BitBucket. If you want to fix bugs or add features, it's the best way to start with
  • Full code is also available from a zip file

When the sources are retrieved you can build a compressed version of the lib using :

$ rake

It'll build a YUI compressed version of the lib in 'dist' directory. You'll also got HTML code documentation in 'doc' directory.

Usage Example

Drop mootools, mootools Tip and gravatar.js in your javascripts directory and include it in your XHTML layout :

<script src="javascripts/mootools.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/mootools-more.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/gravatar.js" type="text/javascript" charset="utf-8"></script>

then you can create new Gravatar instances :

new Bounga.Gravatar({md5: "855c677aca7319a44da19fb583b9f320", size: 200, extension: '.png'});

// or

new Bounga.Gravatar({email: "nico@bounga.org", size: 200, extension: '.png'});

Take a look at 'example' directory to see examples.

Options

Available options to tune your Gravatar are:

size: 100           // Default size you want to use for the picture.
extension: '.jpg'   // Extension you want to use for the picture.
rating: 'g'         // Rating level.
defaultImage: null  // Default image to use
email: null         // plain text email to use
md5: null           // already MD5 hashed email (so much better for your users)

Other

If you want to contribute you should take a look at:

Problems, comments, and suggestions are welcome on the ticket system.

Copyright (c) 2011 Nicolas Cavigneaux, released under the MIT license

Updated