Gravatar Control Update

Update – 12 June 2008

An updated version of this post, containing full source for the control and explanation is available here.

Original Post

The guys over at Gravatar.com have been hard at work updating their service, and I’ve updated the ASP.NET control I developed to reflect the changes.

The maximum size of Gravatars has now been increased from 80 to 512, so there’s a code change in the Render method:

// if the size property has been specified, and in the range
// 1..512:
try
{
    // if it's not in the allowed range, throw an exception:
    if (Size < 1 || Size > 512)
        throw new ArgumentOutOfRangeException();
}
catch
{
    Size = 80;
}

So, a default of 80 will still be used if the value specified is not within the 1 to 512 range, or it is not specified, but allows for a larger size.

The avatar.php URL serving the images now supports abbreviation, but the code in the control has not been changed.

Design time view of the control

The image shows the Design time view of the control, with the width set at the default value of 80. I’ve checked the control at 512 pixels, but my Gravatar doesn’t look too good expanded out to that size, so I’ve decided to stick at size 80 for the screenshot!

  • abhijeet

    Is it possible to use gravatar with visual web developer express editions if yes how do i implement that??

  • http://www.freshclickmedia.com shane

    Thanks for asking abhijeet.

    To use the control, ensure you’re looking at an aspx page on your website. Then show the toolbox (View->Toolbox from main menu), and then right click on the General header in the toolbox.

    From the context menu, select “Choose Items” and browse to the assembly (Freshclickmedia.Web.dll), and click “OK” to add.

    You may also be interested to know that I’ve posted another Gravatar post with full source code and instructions and screenshots on adding to the toolbox, as I described in this reply.

    Go check out the new post for further details.

    Hope this helps.

  • krishan

    i want to make a project based on the gravatar concept.its name is profile delievery sysstem.can you tell me how to start it?

    • admin

      Hi Krishnan,

      could you go into a little more detail?