# Gravatars

**URL:** <https://www.ruby-forum.com/t/gravatars/142374>\
**Category:** Rails\
**Created:** [July 7, 2008, 1:01pm UTC](https://www.ruby-forum.com/t/gravatars/142374 "2008-07-07T13:01:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BelSSSSn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/90db22/32.png) [@BelSSSSn](https://www.ruby-forum.com/u/BelSSSSn)\
**Post date:** [July 7, 2008, 1:01pm UTC](https://www.ruby-forum.com/t/gravatars/142374/1 "2008-07-07T13:01:14Z")

</div>

I want to put some icons in a web and I want to know how can I detect  
if a person has a gravatar so in case they don’t have one I want to  
show another icon, can anyone help me??  
Thanks in advance  
Belén

---

<div class="post-metadata">

**Author:** ![BelSSSSn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/90db22/32.png) [@BelSSSSn](https://www.ruby-forum.com/u/BelSSSSn)\
**Post date:** [July 7, 2008, 1:44pm UTC](https://www.ruby-forum.com/t/gravatars/142374/2 "2008-07-07T13:44:37Z")

</div>

I tried a while ago to implement this and finished doing a column in  
the users table saying wants\_gravatar:boolean. If it was true, then  
the user.face method would return their gravatar picture like so:

if wants\_gravatar?  
“[http://www.gravatar.com/avatar.php](http://www.gravatar.com/avatar.php)?  
gravatar\_id=#{Digest::MD5.hexdigest(email\_address)}”  
else  
self.avatar ? self.avatar.public\_filename : DEFAULTFACE  
end

but actually checking wether the email address mapped any pictures in  
gravatar or not, i could not find a way. I decided that if the user  
wanted a gravatar an didnt have one, hed just get the gravatar logo.  
it was so much less painfull to implement.

It still appreciate if anyone knew how to perform the check.

j

On Jul 7, 12:00 pm, Belén [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I want to put some icons in a web and I want to know how can I detect  
> if a person has a gravatar so in case they don’t have one I want to  
> show another icon, can anyone help me??  
> Thanks in advance  
> Bel

---

<div class="post-metadata">

**Author:** ![BelSSSSn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/90db22/32.png) [@BelSSSSn](https://www.ruby-forum.com/u/BelSSSSn)\
**Post date:** [July 7, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/gravatars/142374/3 "2008-07-07T13:56:57Z")

</div>

seems there are two plugins available:  
[http://en.gravatar.com/site/implement/rails](http://en.gravatar.com/site/implement/rails)

but none of them seems to implement any check, if a gravatar exists  
as far as I can see, the only thing possible is to set one of three  
default images:

[http://en.gravatar.com/site/implement/url](http://en.gravatar.com/site/implement/url)
