Skip to content

mission-met/rails_gravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rails_gravatar

A simple gem for for generating Gravatar images and tags in a Rails environment.

Installation

gem install rails_gravatar

Example Usage

require 'rails_gravatar'

# Generate only the image URL
RailsGravatar.src("[email protected]")
RailsGravatar.src("[email protected]", 32) # with size
RailsGravatar.src("[email protected]", 32, "http://email.com/image.png") # with fallback image url

# Generate the whole image tag
RailsGravatar.tag("[email protected]")
RailsGravatar.tag("[email protected]", 32) # with size
RailsGravatar.tag("[email protected]", 32, "http://email.com/image.png", "The image alt text") # with fallback image url

Using with Rails

Because we are using the Rails tag helpers, you do not need to use tag helpers such as raw or .html_safe.

<%= Gravatar.src("[email protected]") %>

Parameters

Gravatar.src(email_address, size, default_image_url)
Gravatar.tag(email_address, size, default_image_url, alt_text)

DNS Prefetch

You can also automatically add the DNS prefetch tag to your page headers using:

<%= Gravatar.prefetch_dns_tag %>

Testing

bundle exec rspec

License

Please see LICENSE for licensing details. This code is MIT licensed and will ALWAYS be MIT licensed.

Author

https://github.com/mission-met https://github.com/rickychilcott

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages