0.0
No release in over 3 years
A simple gem for for generating Gravatar images and tags in a Rails environment.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

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("me@email.com")
RailsGravatar.src("me@email.com", 32) # with size
RailsGravatar.src("me@email.com", 32, "http://email.com/image.png") # with fallback image url

# Generate the whole image tag
RailsGravatar.tag("me@email.com")
RailsGravatar.tag("me@email.com", 32) # with size
RailsGravatar.tag("me@email.com", 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("me@email.com") %>

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