.NET Gravatar Library

I’ve updated my Gravatar source. I am no longer working on the control version. I have focused my attention to a library model. With the library you are able to manipulate the image more then you could with the control. The image is stored in memory as passed as an image. I am working on arrays that will allow you to pass an overload containing a list of emails and return the Gravatar in the given order.

You can find out more here!

Popularity: unranked [?]

GravatarGet: Source Code

I’ve updates the GravatarGet page. I’ll be explaining the source code and releasing a major portion of the code. There’s already been over 5,000 downloads and the number is growing everyday. There are reports of bugs and what not, I will address them here.

Default Icon Struct:
I did this so we wouldn’t have to remember the names of the 3 fallback icon sets Gravatar offers.

Rating Struct:
Sure, there are only 4 ratings(G, PG, R, X) but maybe someone don’t know that. So I created a struct for this as well.

Some people are having trouble returning an image into memory. I recommend using MemoryStream for this. You can also attach the Gravatar to a listbox, combobox,textbox and almost any other control applicable.

So check out the Gravatar page and enjoy!

Popularity: unranked [?]

Gravatar & .NET

Some emails coming in wanting to know an easy way to get Gravatars into their .NET applications. I’ll show 2 ways, both in C# and VB.

First I’ll share with you my MD5 function used to return the hash of a string. In this case, the hash of a users email address.

Function MD5(ByVal strToHash As String) As String
Dim md5Obj As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)

bytesToHash = md5Obj.ComputeHash(bytesToHash)

Dim strResult As String = ""

For Each b As Byte In bytesToHash
strResult += b.ToString("x2")
Next

Return strResult
End Function

Create a new windows forms application and add a single picturebox control. For test/example purpose, please the following code in your “Form1_Load” sub.

'Declare a constant here that is half of our URL
Const GURL = "http://www.gravatar.com/avatar/"

'GravatarSize ranges from 1-512
'Rating ranged from G, PG, R, X
'IconType ranges from monsterid, identicon, wavatar
Dim tmp As String = GURL & MD5(Email) & "?s=" & GravatarSize & "&r=" & Rating & "&d=" & IconType

'Now lets use the picturebox "ImageLocation" method to load the Image.
picGravatar.ImageLocation = tmp

An example would be:

Dim tmp As String = GURL & MD5(dremation@gmail.com) & "?s=60&r=g&d=monsterid"

The result would be
Gravatar

 

Now, for the C# example. Although C# and VB are very close in syntext I will include this example as well.
First, here is the MD5 function.

 private string  MD5(string Email)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.ASCII.GetBytes(Email);
data = x.ComputeHash(data);
string ret = "";
for (int i = 0; i < data.Length; i++)
ret += data[i].ToString("x2").ToLower();
return ret;
}

And now let’s get the Gravatar and show it in the picturebox.

 const string GURL = "http://www.gravatar.com/avatar/";

string tmp = GURL + MD5("dremation@gmail.com") + "?s=60&r=g&d=monsterid";
picGravatar.ImageLocation = tmp;

And there you have C# and VB .NET examples on how to retrieve a Gravatar using a users email address. This is nice because using this method is fast and simple.

Popularity: unranked [?]

GravatarGet: Update

I’ve updated my user control for Gravatar. Version now is, 1.2.4.0. I’ve adds support for a caption bar to shows the users email address along with the avatar. I’ve added 4 new properties that allow you to control the size, rating, email and caption. I have plans to add support for frames/borders, info overlays, captions on the left, right, top of avatar, mouse over effects and more.

Check out the new version here!

Popularity: unranked [?]

Gravatar .NET Control

UPDATE AND PAGE HERE

I’m working on a .NET Gravatar control. A user will be able to retrieve the given emails avatar, or fallback to a default avatar provided by Gravatar.  The developer will be able to control the [size],[rating],[fallback image]. 

Why? That’s easy! Maybe you are developing an application that involves chat, email, p2p activities or something like that. Isn’t it nice to show your picture? I’m sure there are other applications for this type of user control.

        GravatarGet1.Email = "dremation@gmail.com"
        GravatarGet1.ShowGravatar(60, "g", "identicon")

The parameters, (60, g, identicon) are the parameters Gravatar allows to be passed.

Size:  Any number from 1 to 512 
Rating: G, PG, R, X
Default: identicon, monsterid, wavatar

test1 Gravatar .NET Control

In the next release I plan on easy methods of defining the parameters. I will also include image ttiels, information titles and context menu support.

Please leave comments for errors, suggestions, ideas and bugs.  

download button Gravatar .NET Control

Popularity: unranked [?]