Gravatar stands for Globally Recognized Avatar. This is the very well known service to show your avatar globally.
You can get Gravatar using an email address. In this post I am going to show you how to show the gravatar using an email address.
I am going to cover this post with PHP.
Get Prepared
To get the Gravatar your must need an email address of which you want to get avatar. After getting an email address we need to create a hash for that email address.
But before creating hash you need to perform some filtering operation on email address. These filtering are like removing all leading and trailing spaces from email address and make sure that all characters are in lower case.
Now for generating hash, means MD5 hash of the filtered email address. Let’s see the below code snippet for the same.
[cc lang=”php”]
$email= ” [email protected] “;
// Removing Spaces
$email = trim($email);
// Make all Lower Case
$email = strtolower($email);
// Generating Hash
$email_hash = md5($email);
[/cc]
Making Simple Request
Please find below structure of the simple request for Gravatar.
[code]http://www.gravatar.com/avatar/EMAIL_HASH[/code]
Here EMAIL_HASH will be replaced by the hash of the filtered email address. We can place this url in src tag of the img tag like below.
[cc lang=”html”]
Wow, this way, now it’s easy to use gravtar in .net as well.
With jQuery we can get the images, and can be integrated easily.
thanks….
Wow, this way, now it’s easy to use gravtar in .net as well.
With jQuery we can get the images, and can be integrated easily.
thanks….
Thx for your sharing. I try now!
Thx for your sharing. I try now!