Gravatar_image_tag

Hi,
In my application I’m using gravatar_image_tag to retrieve user’s
avatar.
I would like to show a custom image(registered in my assets directory)
in
case that user do not have an gravatar account.
How could I do it?

thx
Bruno M.

read or watch Ryan B. RailsCasts episode #244:

http://railscasts.com/episodes/244-gravatar?view=asciicast

Thx soldier,
I will take a look :smiley:

its about 4 minutes in.

The gravatar_image_tag gem has a configuration point for setting your
own default image rather then using the Gravatar default.

You can do it inline like so:

gravatar_image_tag(‘[email protected]’, :gravatar => { :default =>
http://example.com/images/your.png’ })

Or you configure it globally in an initializer

config/initilizers/gravatar_image_tag.rb

GravatarImageTag.configure do |config|
config.default_image = ‘http://example.com/images/your.png
end

Refer to the README for more information
https://github.com/mdeering/gravatar_image_tag

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs