Created
July 12, 2016 21:23
-
-
Save Piterden/52b13b8b785ec38c81252e6808c94769 to your computer and use it in GitHub Desktop.
[PHP] Get Gravatar Image from user email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate Gravatar image for user | |
* @param string | |
* @return string | |
*/ | |
public function getImageAttribute($value) | |
{ | |
$gravemail = md5( | |
strtolower( | |
trim($this->email) | |
) | |
); | |
return 'https://www.gravatar.com/avatar/'.$gravemail.'?s=128&d=mm'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment