Skip to content

Instantly share code, notes, and snippets.

@thrasos
Created April 14, 2016 01:32
Show Gist options
  • Save thrasos/426df29a6fc6c9e062125fa603c02563 to your computer and use it in GitHub Desktop.
Save thrasos/426df29a6fc6c9e062125fa603c02563 to your computer and use it in GitHub Desktop.
Gravatar API in PHP, simple echo.
/*
*@email - Email address to show gravatar for
*@size - size of gravatar
*@default - URL of default gravatar to use
*@rating - rating of Gravatar(G, PG, R, X)
*/
function show_gravatar($email, $size, $default, $rating)
{
echo '<img src="http://www.gravatar.com/avatar.php?gravatar_id='.md5($email).
'&default='.$default.'&size='.$size.'&rating='.$rating.'" width="'.$size.'px"
height="'.$size.'px" />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment