i want to use gravatar to show pictures on my platform, but instead of doing so i only see the MD5 hash.
Here is my code of "application_helper.rb"
def avatar_url(user)
gravatar_id = Digest::MD5::hexdigest(user.email).downcase
"https//www.gravatar.com/avatar/#{gravatar_id}.jpg?d=identical&s=150"
end
end
I also tried d=mm
and d=identicon
, which also did not work.
Here is the code im using in the navbar:
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false">
<%= image_tag avatar_url(current_user), class: "img-circle" %>
<%= current_user.fullname %> <span class="caret"></span>
</a>
Anything i could try?
Thank you for your help :)
Your gravatar URL is wrong, you're missing the :
after https
. Also the www
is not necessary.
def avatar_url(user)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
"https://gravatar.com/avatar/#{gravatar_id}.jpg?d=identical&s=150"
end
end