Using Gravatars In Your Script

/ Published in: PHP
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  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="'.$params.'" width="'.$size.'px" height="'.$size.'px" />';
  6. echo $output;
  7. }
  8. ?>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.