Announcing Gravatar.NET
Introduction
For a while now I’ve been working on an implementation of the Gravatar public API.
Unfortunately it took longer than I had intended, what with those pesky work commitments and personal life issues…
I’m glad to tell you that Gravatar.NET is now available for download on Codeplex.
If you don’t know what Gravatar is, it’s: “A Globally Recognized Avatar”, allowing you to store a personal image (or images) and reuse it across different websites that support the use of it (example: WordPress.com).
If you’re building a website that includes storing user account information, and let’s face it, what website doesn’t do that these days, then typically one of the things your users expect is to be able to associate a photo to recognize their account on the site. Instead of having to store and manage these photos on your server (sometimes with a bandwidth/storage limit), Gravatar can do it for you.
This means though that users will have to leave your website and go to the Gravatar site to manage their photos, what if you don’t want your users to leave the site to upload new photos, select a photo to activate or delete an existing image. Well, if it’s a ASP.NET website you can make use of my Gravatar.NET library to simplify the integration so they can do it all directly from your page.
You can see such an integration in action on Ponderi.Com, a new website (a social communities website) I’ve been helping to create which is still very much at the beginning of it’s way.
Here’s how it looks like:
Ponderi uses a mix of the Gravatar.NET library, WCF, jQuery and the jquery image crop plugin to allow users to fully manage their Gravatar interaction through the site.
If the user doesn’t have a Gravatar account they will have to shortly go to Gravatar.com to create it though.
Gravatar.NET Library
The Gravatar.NET library makes it very easy to use the methods exposed by the Gravatar API, these methods include:
- Test
- Exists
- Addresses
- UserImages
- SaveData
- SaveUrl
- UseUserImages
- RemoveImage
- DeleteUserImage
This is an example of how to use the Addresses method that returns a collection of email addresses linked to the Gravatar account:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
var m_Email = "myemail@mydomain.com";
var m_Password = "my password";
var service = new GravatarService(m_Email, m_Password);
GravatarServiceResponse response = service.Addresses();
if (!response.IsError) //no error, check results
{
foreach (GravatarAddress adr in response.AddressesResponse)
{
Console.WriteLine("Address: '{0}', active image URL: '{1}'",
adr.Name, adr.Image.Url);
}
}
else //error occurred, show info
{
Console.WriteLine("Error: {0}) {1}", response.ErrorCode,
response.ErrorInfo);
}
|
The library implements all methods in both a synchronous and asynchronous pattern.
You can find more documentation, the binaries, source code and demo projects all on the Gravatar.Net Codeplex page.
I’ll appreciate all comments about this first project of mine made public.

grate place to be