Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active December 17, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/5640611 to your computer and use it in GitHub Desktop.
Save jaredatch/5640611 to your computer and use it in GitHub Desktop.
Get a gravatar URL
<?php
/**
* Get the gravatar URL
*
* @since 1.0.0
* @param string $email
* @param int $size
* @return string
*/
function ja_get_gravatar_url( $email, $size = '120' ) {
$hash = md5( strtolower( trim ( $email ) ) );
$url = 'http://gravatar.com/avatar/' . $hash;
if ( !empty ( $size) )
$url .= $url . '?s=' . $size;
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment