Gravatar

The Eewee responsive design Gravatar class.

Defined (1)

The class is defined in the following location(s).

/inc/controllers/GravatarController.php  
  1. class Gravatar{ 
  2.  
  3. /** 
  4. * Get either a Gravatar URL or complete image tag for a specified email address. 
  5. * @param string $email The email address 
  6. * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ] 
  7. * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] 
  8. * @param string $r Maximum rating (inclusive) [ g | pg | r | x ] 
  9. * @param boole $img True to return a complete IMG tag False for just the URL 
  10. * @param array $atts Optional, additional key/value attributes to include in the IMG tag 
  11. * @return String containing either just a URL or a complete image tag 
  12. * @source http://gravatar.com/site/implement/images/php/ 
  13. */ 
  14. function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) { 
  15. $url = 'http://www.gravatar.com/avatar/'; 
  16. $url .= md5( strtolower( trim( $email ) ) ); 
  17. $url .= "?s=$s&d=$d&r=$r"; 
  18. if ( $img ) { 
  19. $url = '<img src="' . $url . '"'; 
  20. foreach ( $atts as $key => $val ) 
  21. $url .= ' ' . $key . '="' . $val . '"'; 
  22. $url .= ' />'; 
  23. return $url; 
  24.