• Entries (RSS)
  • Comments (RSS)

The power of Globally Recognized Avatar (aka Gravatar)

Posted by | Posted in How to, PHP, Resources, Reviews, Tips and Tricks, Tutorials | Posted on 19-Feb-2009

Tagged Under :

Gravatar has a very sleak concept but not many people know and understand it. It is one place for your display pictures and you can use the same at any Gravatar enabled website / application. Gravatar is currently used in WordPress, Movable Type, Drupal, Joomla and Mac OS X Addressbook.

Advantages are mainly on the user end where he/she can change one photo and reflect it in multiple places. It includes support for content-rating etc.

Here, I will show how it is implemented in PHP

$email = "my-email@hotmail.com";
$default = "http://www.somewhere.com/homestar.jpg";
$size = 100;

$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($email)).
			"&default=".urlencode($default).
			"&size=".$size;

Now use it in your HTML as

<img src="<?php echo $grav_url; ?/>" width="< ?php echo $size; ?>" alt="Gravatar" />

Simple!!

More info at the URLs below

Share This:
  • Facebook
  • Digg
  • Google Bookmarks
  • Sphinn
  • del.icio.us
  • Fark
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati
  • Yahoo! Buzz
  • RSS

Related Posts (auto suggestions based on tags)

Comments

2 comments posted on The power of Globally Recognized Avatar (aka Gravatar)

  1. yeah, a simple and great tip =D

    regards

  2. Thank you

Post a Comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes