DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Chara has posted 50 posts at DZone. View Full User Profile

Using Gravatars In Your Script

02.12.2013
| 2959 views |
  • submit to reddit
<?php
// source: http://www.apphp.com/index.php?snippet=php-using-gravatars-in-your-script
function show_my_gravatar($email, $size, $default, $rating)
{
  $params = '?gravatar_id='.md5($email).'&default='.$default.'&size='.$size.'&rating='.$rating;
  $output = '<img src="http://www.gravatar.com/avatar.php'.$params.'" width="'.$size.'px" height="'.$size.'px" />';
  echo $output;
}
?>

  With increasing of popularity of WordPress script, Gravatars have become a rellay quite popular. Now you may easy integrate them into your own script as they provide a very easy to use API.

Comments

Michael Molo replied on Thu, 2013/02/21 - 2:34am