All Projects → mdeering → Gravatar_image_tag

mdeering / Gravatar_image_tag

Licence: mit
A configurable and documented Rails view helper for adding gravatars into your Rails application

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Gravatar image tag

Navigasmic
Navigasmic: Semantic navigation for Rails using simple view level or configuration definitions.
Stars: ✭ 327 (-8.91%)
Mutual labels:  rails
Tomatoes
Pomodoro Technique® online time tracker
Stars: ✭ 344 (-4.18%)
Mutual labels:  rails
Algoliasearch Rails
AlgoliaSearch integration to your favorite ORM
Stars: ✭ 352 (-1.95%)
Mutual labels:  rails
Homeland
🎪 An open source forum/community system based on Rails, developed based on Ruby China.
Stars: ✭ 3,511 (+877.99%)
Mutual labels:  rails
Spree i18n
I18n translation files for Spree Commerce.
Stars: ✭ 338 (-5.85%)
Mutual labels:  rails
Wechat Starter
Template for developing wechat in rails
Stars: ✭ 347 (-3.34%)
Mutual labels:  rails
Ahoy
Simple, powerful, first-party analytics for Rails
Stars: ✭ 3,478 (+868.8%)
Mutual labels:  rails
Bootstrap Generators
Bootstrap-generators provides Twitter Bootstrap generators for Rails
Stars: ✭ 355 (-1.11%)
Mutual labels:  rails
Api.rss
RSS as RESTful. This service allows you to transform RSS feed into an awesome API.
Stars: ✭ 340 (-5.29%)
Mutual labels:  rails
Rails performance
Monitor performance of you Rails applications
Stars: ✭ 345 (-3.9%)
Mutual labels:  rails
Clearance
Rails authentication with email & password.
Stars: ✭ 3,467 (+865.74%)
Mutual labels:  rails
Anycable Rails
AnyCable Rails integration
Stars: ✭ 338 (-5.85%)
Mutual labels:  rails
Reports kit
Beautiful, interactive charts and tables for Ruby on Rails
Stars: ✭ 349 (-2.79%)
Mutual labels:  rails
Log analyzer
Rails logs analyzer (see how fast your views are rendering)
Stars: ✭ 333 (-7.24%)
Mutual labels:  rails
App perf
Open source application performance monitoring tool with emphasis on ease of setup and use. Providing similar functionality like NewRelic/AppNeta/Skylight etc.
Stars: ✭ 353 (-1.67%)
Mutual labels:  rails
Envied
Ensures presence and type of your app's ENV-variables (mirror)
Stars: ✭ 327 (-8.91%)
Mutual labels:  rails
Commit Watcher
Find interesting and potentially hazardous commits in git projects
Stars: ✭ 345 (-3.9%)
Mutual labels:  rails
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (-0.28%)
Mutual labels:  rails
Migration data
Safely migrate data in ActiveRecord migrations and keep them up to date.
Stars: ✭ 354 (-1.39%)
Mutual labels:  rails
Rack Dev Mark
Show dev mark on development env
Stars: ✭ 350 (-2.51%)
Mutual labels:  rails

!http://s.gravatar.com/images/logo.png(Gravatar Logo)!

h1. Gravatar Image Tag Plugin

Rails view helper for grabbing "Gravatar":http://en.gravatar.com/ images. The goal here is to be configurable and have those configuration points documented!

h2. Install as a Ruby Gem

h3. Rails 2

p. Include the following line in your Rails environment

# config/environment
  config.gem 'gravatar_image_tag'

p. Then ensure the gem is installed by running the following rake task from the your application root.

rake gems:install

h3. Rails 3

p. Include the following line in your Rails environment

# Gemfile
  gem 'gravatar_image_tag'

p. Then ensure the gem is installed by running the following command from the application root.

bundle install

h2. Install as a Ruby on Rails Plugin

./script/plugin install git://github.com/mdeering/gravatar_image_tag.git

h2. Usage

h3. Gravatar Image Tag

p. Once you have installed it as a plugin for your rails app usage is simple.

gravatar_image_tag('[email protected]'.gsub('spam', 'mdeering'), :alt => 'Michael Deering')

Boom here is my gravatar !http://www.gravatar.com/avatar/4da9ad2bd4a2d1ce3c428e32c423588a(Michael Deering)!

h3. Gravatar Image URL

p. You can also return just the Gravatar URL:

gravatar_image_url('[email protected]'.gsub('spam', 'mdeering'), filetype: :png, rating: 'pg', size: 15, secure:false )

p. Useful when used in your inline CSS.

h2. Configuration

h3. Global configuration points

# config/initializers/gravatar_image_tag.rb
GravatarImageTag.configure do |config|
  config.default_image           = nil   # Set this to use your own default gravatar image rather then serving up Gravatar's default image [ 'http://example.com/images/default_gravitar.jpg', :identicon, :monsterid, :wavatar, 404 ].
  config.filetype                = nil   # Set this if you require a specific image file format ['gif', 'jpg' or 'png'].  Gravatar's default is png
  config.include_size_attributes = true  # The height and width attributes of the generated img will be set to avoid page jitter as the gravatars load.  Set to false to leave these attributes off.
  config.rating                  = nil   # Set this if you change the rating of the images that will be returned ['G', 'PG', 'R', 'X']. Gravatar's default is G
  config.size                    = nil   # Set this to globally set the size of the gravatar image returned (1..512). Gravatar's default is 80
  config.secure                  = false # Set this to true if you require secure images on your pages.
end

h3. Setting the default image inline

p. Splat the default gravatar image !http://www.gravatar.com/avatar/0c821f675f132d790b3f25e79da739a7(Default Gravatar Image)!

p. You can set the default gravatar image inline as follows:

gravatar_image_tag('junk', :alt => 'Github Default Gravatar', :gravatar => { :default => 'https://assets.github.com/images/gravatars/gravatar-140.png' })

p. Ka-Pow !https://assets.github.com/images/gravatars/gravatar-140.png(Github Default Gravatar)!

p. Other options supported besides an image url to fall back on include the following:

h3. Setting the default image size

p. You can set the gravatar image size inline as follows:

gravatar_image_tag('[email protected]'.gsub('spam', 'mdeering'), :alt => 'Michael Deering', :class => 'some-class', :gravatar => { :size => 15 })

Mini Me! !(some-class)http://www.gravatar.com/avatar/4da9ad2bd4a2d1ce3c428e32c423588a?size=15(Michael Deering)!

h3. Grabbing gravatars from the secure gravatar server.

p. You can make a request for a gravatar from the secure server at https://secure.gravatar.com by passing the :gravatar => { :secure => true } option to the gravatar_image_tag call.

gravatar_image_tag('[email protected]'.gsub('spam', 'mdeering'), :alt => 'Michael Deering', :gravatar => { :secure => true } )

Delivered by a secure url! !https://secure.gravatar.com/avatar/4da9ad2bd4a2d1ce3c428e32c423588a(Michael Deering)!

h3. Using Gravatar's built in rating system

p. You can set the gravatar rating inline as follows:

gravatar_image_tag('[email protected]'.gsub('spam', 'mdeering'), :alt => 'Michael Deering', :gravatar => { :rating => 'pg' } )

h3. Specifying a filetype

p. You can set the gravatar filetype inline as follows:

gravatar_image_tag('[email protected]'.gsub('spam', 'mdeering'), :alt => 'Michael Deering', :gravatar => { :filetype => :gif } )

h2. Credits

The ideas and methods for this plugin are from expanding upon my original blog post "Adding Gravatar To Your Website Or Blog (Gravatar Rails)":http://mdeering.com/posts/005-adding-gravitar-to-your-website-or-blog

Copyright (c) 2009-2010 "Michael Deering(Ruby on Rails Development Edmonton)":http://mdeering.com, released under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].