Skip to content

Instantly share code, notes, and snippets.

@cherifgx
Created March 26, 2013 05:04
Show Gist options
  • Save cherifgx/5243268 to your computer and use it in GitHub Desktop.
Save cherifgx/5243268 to your computer and use it in GitHub Desktop.
With ever increasing popularity of WordPress, Gravatars have become quite popular. It is very easy to integrate them into your application as they provide a very easy to use API.
<?php
/******************
*@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