Skip to content

Instantly share code, notes, and snippets.

@tracend
Created November 22, 2012 11:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tracend/4130741 to your computer and use it in GitHub Desktop.
Save tracend/4130741 to your computer and use it in GitHub Desktop.
Handlebars.js - Gravatar thumbnail #handlebars #cc
// Handlebars.js - Gravatar thumbnail
// Usage: {{#gravatar email size="64"}}{{/gravatar}} [depends on md5.js]
// Author: Makis Tracend (@tracend)
Handlebars.registerHelper('gravatar', function(context, options) {
var email = context;
var size=( typeof(options.hash.size) === "undefined") ? 32 : options.hash.size;
return "http://www.gravatar.com/avatar/" + MD5( email ) + "?s="+ size;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment