diff --git a/src/Thomaswelton/LaravelGravatar/Gravatar.php b/src/Thomaswelton/LaravelGravatar/Gravatar.php index 7d3a75d..31385c0 100644 --- a/src/Thomaswelton/LaravelGravatar/Gravatar.php +++ b/src/Thomaswelton/LaravelGravatar/Gravatar.php @@ -51,4 +51,14 @@ public function image($email, $alt = null, $attributes = array(), $rating = null return HTML::image($src, $alt, $attributes); } + + public function exists($email) + { + $this->setDefaultImage('404'); + + $url = $this->buildGravatarURL($email); + $headers = get_headers($url, 1); + + return strpos($headers[0], '200') ? true : false; + } }