Add WordPress like Gravatars in Your Application

Add Wordpress like Gravatars in Your Application

Hello friends, welcome to today snippet post on add Gravatar in your application. Most of people, who know WordPress are very use to with “Gravatar” terms. Let’s have some idea about “Gravater”.

– What is a Gravatar?

Gravatar stands for Globally Recognized Avatar. It is globally recognized because millions of people and websites use them. Most popular applications like WordPress have built-in support for Gravatar. When a user leaves a comment (with email) on a site that supports Gravatar, it picks their Globally Recognized Avatar from Gravatar servers. Then that image is shown next to the comment. This allows each commenter to have their identity through out the world wide web.

– How to Add WordPress like Gravatars in Your Application:

It’s very simple and easy function. Have a look at snippets.

function show_gravatar($email, $size, $default, $rating) 
{ 
    echo '<img src="http://www.gravatar.com/avatar.php?gravatar_id='.md5($email). 
        '&default='.$default.'&size='.$size.'&rating='.$rating.'" width="'.$size.'px"
        height="'.$size.'px" />'; 
}

Enjoy!

Share It

Related Posts