Solibulo

Uninteresting things
2008-08-19 10:48
by softlion

Today I present an easy to use open source gravatar control.
To show a gravatar logo of one of your visitor you'll need only the visitor's email.

 

I took the source code from the reference implementation advertised on Gravatar from freshclickmedia (see references at the bottom of this article), updated it to match the new gravatar API, and among other things fixed the ViewState implementation.

 

Basic usage
1) In your project add a reference to the assembly FreshClickmedia.Web.dll
2) At the top of your aspx or ascx page add:
<%@ Register TagPrefix="fcm" Assembly="FreshClickmedia.Web" Namespace="FreshClickMedia.Web.UI.WebControls" %>
3) In your page add this tag where you want the logo to appear:
<fcm:Gravatar ID="GravatarImage" runat="server" Email="thisemaildoesnotexist@thisemaildoesnotexist.com" />

 

References
Gravatar: http://www.gravatar.com/
Original ASP.NET control from freshclickmedia: http://www.freshclickmedia.com/blog/2008/06/aspnet-gravatar-control-update-full-source-included/

 

Downloads
.NET Assembly only
Full source code with example web site

 

Examples

My email address, size of 80 pixels:
<fcm:Gravatar ID="Gravatar1" runat="server" Email="putexistingemailhere@putexistingemailhere.com" OutputGravatarSiteLink="true" Size="80" />
Gravatar

No email address, with default image (absolute url) specified:
<fcm:Gravatar ID="Gravatar2" runat="server" Size="80" DefaultImageUrl="http://farm3.static.flickr.com/2375/2552064340_192825f989_o.jpg" />
Gravatar

Email address not associated with Gravatar, with no default image (identicon):
<fcm:Gravatar ID="Gravatar3" runat="server" Email="thisemaildoesnotexist@thisemaildoesnotexist.com" />
Gravatar

Email address not associated with Gravatar, with no default image (wavatar):
<fcm:Gravatar ID="Gravatar4" runat="server" Email="thisemaildoesnotexist@thisemaildoesnotexist.com" DefaultImageType="Wavatar" />
Gravatar

Email address not associated with Gravatar, with no default image (Monsterid):
<fcm:Gravatar ID="Gravatar5" runat="server" Email="thisemaildoesnotexist@thisemaildoesnotexist.com" DefaultImageType="Monsterid" />
Gravatar 

 

Comments are closed