GetGravatar updated to 1.2

With an update so big that it had to skip a whole point, i'm happy to announce that GetGravatar is now updated to 1.2. Now with 100% less PHP required, and 50% less AJAX calls!

Basically, I removed the dependency on the PHP file, and integrated a couple of functions from the awesome php.js project in order to speed things up significantly.

Quick download link

Parameters

  • fallback (string): URL to your placeholder image for if the user does not have a Gravatar. Must be an exact URL.
  • avatarSize (number, 0-512): Size in pixels of the gravatar to fetch.
  • avatarContainer (string): jQuery style selector of the tag to put the gravatar in once it’s loaded. Default is "#gravatar".
  • start (function): Function to run when it starts loading. Perfect place to put code for a Loading indicator.
  • stop (function): Function to run when it’s done loading. Perfect place to put code to hide a Loading indicator.

Code examples:

Barebones usage:

$("#email-address").getGravatar();

Simple parameters:

$("#email-address").getGravatar({
	fallback: 'http://myurl.com/images/default.png'
});

More parameters:

$("#email-address").getGravatar({
	fallback: 'http://myurl.com/images/default.png',
	avatarSize: 80,
	avatarContainer: '#gravatar-container'
});

Specify start and stop functions

$("#email-address").getGravatar({
	start: function(){
		$("loading").show();
	},
	stop: function(){
		$("loading").hide();
	}
});

You can download the plugin below:

Download getgravatar-1.2.zip

ZIP Format, 41 kb

Or check it out on Github.