Created
December 15, 2011 23:49
-
-
Save luisdalmolin/1483544 to your computer and use it in GitHub Desktop.
Pegando imagem do Gravatar com PHP
This file contains hidden or 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 | |
function getAvatar() { | |
$email = '[email protected]'; // e-mail de cadastro para pegar as imagens | |
$default = '_img/sem-imagem-perfil.png'; // imagem alternativa para se não existir | |
$size = 25; // tamanho da imagem | |
$grav_url = "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . | |
"?d=" . urlencode( $default ) . "&s=" . $size; | |
return $grav_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment