Working With Gravatar Images

Friday, April 11, 2008 by Mistlee

Can't see any images? -!

C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles

ZoomInfo API - ASP.NET C#
Over the last couple of days I have been digging into the ZoomInfo API (using C# - ASP.Net) to first of all better understand the API and secondly to leverage the...

OpenID Implementation In C# & ASP.NET
Over the weekend I began looking more deeply into OpenID than I have before. I've always been intrigued by OpenID, but the information about it in terms...

IDataRecord Fields To Dictionary Extension Method
I have never been a fan of directly passing IDataRecords, or IDataReaders for that matter, about the place to get simple field values out. herefore, with the introduction...

ECMAScript, The New C++?
Everything but a call for a kitchen sink subroutine has been tossed into ECMAScript 4, leaving a couple of bloggers wondering why. ECMAScript has appeal...

Responses To Microsoft Releasing .NET 3.5 Source
So far the views from Dave, whurley, Matt and others have been negative to handle with caution. After I heard that Microsoft was releasing the .NET 3.5 source...

Resolve & Shorten URLs In C#
Recently I've needed a method that would look at some text and automatically discover all URLs and turn them into hyperlinks. I've done that before so it was...

Yahoo SiteExplorer API With C#
If you are interested in using Yahoo's SiteExplorer API and are coding in the ASP.NET environment using C# (web pages) then the following method might be of...


Working With Gravatar Images

By Mads Kristensen

Gravatar is a service that associates your e-mail addresses with a picture of you for use on blog comments, forums and bulletin boards. I've been a happy user for years.

A cool thing about Gravatar images is that they can be used from any application either on a website or a desktop application. But still, they are primarily used on blogs and forums.

Today, I played with the thought of a wider use and wrote some code that makes working with Gravatars very easy on both web and the desktop. The reason for this is that I needed a way to collect Gravatar images for a list of users, but only the users that actually have a Gravatar associated with their e-mail address.

The Gravatar service doesn't have an API you can use to check if an e-mail address is associated or not. But by downloading a Gravatar image, the response header Last-Modifed is 1970-01-01 if no image is found and the default image is returned. This information can be used to only store the images users have uploaded to the Gravatar service.

Download a Free Trial of Ektron CMS400.NET

An example

The class is called Gravatar and is very simple and small. Here is an example of using the class to download a Gravatar image and save it to disk.


Download the class below and put it in your App_Code folder. Then you can use the example above from any ASP.NET page or control. (888,00 bytes)


About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.
About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2008 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

Unsubscribe from CProgrammingTrends.
To unsubscribe from CProgrammingTrends or any other iEntry publication, simply send an email request to:
CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact