jeudi 25 juin 2020

Gravatar shows hash instead of picture

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=mmand 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" %>&nbsp;
                  <%= current_user.fullname %> <span class="caret"></span>
</a>

Picture of the navbar

Anything i could try?

Thank you for your help :)

Aucun commentaire:

Enregistrer un commentaire