Add WordPress like Gravatars in Your Application

Add Wordpress like Gravatars in Your Application

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.

– Add WordPress like Gravatars in Your Application:

Just call the show_gravatar() function from your PHP application. You must add the user valid email address to fetch and display the image. Here goes the code.

function show_gravatar( $email, $size, $default, $rating ) {

echo '<img src="' . md5($email) . '&default=' . $default . '&size=' . $size . '&rating=' . $rating . '" width="' . $size . 'px" height="' . $size . 'px" />';


I hope that helps you. Let me know in the comment box below, if you have further questions about it.

Total 0 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment

Back To Top