Skip to content

Instantly share code, notes, and snippets.

@itsbalamurali
Created November 27, 2012 07:08
Show Gist options
  • Save itsbalamurali/4152871 to your computer and use it in GitHub Desktop.
Save itsbalamurali/4152871 to your computer and use it in GitHub Desktop.
Simple PHP Gravatar Function
<?php
/**
Load a gravatar.
*/
function gravatar($email = '', $rating = 'pg') {
$default = "path/to/defava.png"; // Set a Default Avatar
$email = md5(strtolower(trim($email)));
$gravurl = "http://www.gravatar.com/avatar/$email?d=$default&s=60&r=$rating";
return '<img src="'.$gravurl.'" width="60" height="60" border="0" alt="Avatar">';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment