I have recently disabled the gravatar support for my avatars on the blog comments page as it just runs too slow. However the flickr avatars still work. Some people have asked me how it works. It is not a big secret and you can find it out by reading the specs on the flickr API. But for you, lazy busy people I’ll print the algorithm I use:
-
You can get the XML from this url:
http://www.flickr.com/services/rest/?method=flickr.people.findByEmail&api_key= ‹api_key›&find_email= ‹email@address›
This XML will return to you the person if they registered on flickr via their entered e-mail address. -
From here you can grab user’s User ID using XPath:
/rsp/user/@nsid
We will use this information later. -
Then we get another XML:
http://www.flickr.com/services/rest/?method=flickr.people.getInfo&api_key= ‹api_key›&user_id= ‹User ID›
Here we try to find out the Server ID of the person. It is an internal flickr structure but it is important. -
Grab Server ID. XPath:
/rsp/person/@iconserver -
Follow this link:
http://static.flickr.com/‹Server ID›/buddyicons/‹User ID›.jpg
this is the avatar!
But beware: the returned avatar could just be a calm grey face as the default avatar used in flickr is still considered an avatar and so will be returned.
Feel free to implement this with your favourite back-end scripting language on your own blog.
R Walker