Posted By

apphp-snippets on 02/26/13


Tagged

php gravatars


Versions (?)

Using Gravatars In Your Script


 / Published in: PHP
 

URL: http://www.apphp.com/index.php?snippet=php-using-gravatars-in-your-script

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

  1. <?php
  2. function show_my_gravatar($email, $size, $default, $rating)
  3. {
  4. $params = '?gravatar_id='.md5($email).'&default='.$default.'&size='.$size.'&rating='.$rating;
  5. $output = '<img src="http://www.gravatar.com/avatar.php'.$params.'" width="'.$size.'px" height="'.$size.'px" />';
  6. echo $output;
  7. }
  8. ?>

Report this snippet  

You need to login to post a comment.