Skip to content

Commit

Permalink
Return null if the server indiciates the gravatar doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Oct 4, 2013
1 parent ffbb528 commit 9b406a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions framework/Service_Gravatar/lib/Horde/Service/Gravatar.php
Expand Up @@ -175,11 +175,15 @@ public function getProfile($mail)
* @param string $mail The mail address.
* @param mixed $opts Additional options. See getAvatarUrl().
*
* @return resource The image as stream resource.
* @return resource The image as stream resource, or null if the server
* returned an error.
*/
public function fetchAvatar($mail, $opts = array())
{
return $this->_client->get($this->getAvatarUrl($mail, $opts))->getStream();
$get = $this->_client->get($this->getAvatarUrl($mail, $opts));
return ($get->code == 404)
? null
: $get->getStream();
}

}

0 comments on commit 9b406a7

Please sign in to comment.