Git Product home page Git Product logo

gravatar's People

Contributors

jgorset avatar michaelklishin avatar michiomochi avatar ndbroadbent avatar pwnall avatar pyro2927 avatar sinisterchipmunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gravatar's Issues

Dependency not specificed

gravatar-ultimate requires rack to run. If you don't have it installed, it will produce an error:

LoadError: cannot load such file -- rack/utils
    from /Users/joe/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/joe/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/joe/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/file_store.rb:4:in `<top (required)>'
    from /Users/joe/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/gravatar-ultimate-1.0.3/lib/gravatar/cache.rb:101:in `default_cache_instance'
    from /Users/joe/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/gravatar-ultimate-1.0.3/lib/gravatar/cache.rb:109:in `cache'
    from /Users/joe/.rbenv/versions/1.9.3-p448/

Best solution would probably be to include it as a dependency in the gemfile

https?

More of a feature request - can the gem bring avatars in via https ?

API doesn't need to be passed hashed emails

I think the api has changed, and no longer needs a hashed array of emails. For example, the following code works now:

def use_user_image!(image_hash, emails)
emails = [emails] unless emails.is_a?(Array)
hash = call('grav.useUserimage', :userimage => image_hash, :addresses => emails)
expire_cache!
return hash
end

I would have submitted a pull request, but I didn't understand your 'dehashify_emails' method. So I've just hacked it up for now.

undefined method 'cache' for Rails::Module when using Sinatra

This is the erorr i get when i try to do this using Sinatra framework

 Gravatar.new(current_user.email).image_url(:ssl => true)

NoMethodError - undefined method cache' for Rails:Module: gems/gravatar-ultimate-2.0.0/lib/gravatar/cache.rb:101:indefault_cache_instance'
gems/gravatar-ultimate-2.0.0/lib/gravatar/cache.rb:109:in cache' gems/gravatar-ultimate-2.0.0/lib/gravatar.rb:44:ininitialize'

Can this be fixed? or is there any work-around? Please help.

Add the forcedefault param

Adding 'forcedefault' or 'f' allows you to ignore the user's gravatar and force it into one of the options (monsterid, identicon, etc...).

I forked the repo and made what I think are the required changes, but I was not able to install the forked gem, and hence I can't test it to see if it works. I've only been doing Ruby and RoR for three days...

More of the f option can be found here: http://en.gravatar.com/site/implement/images/ under "Force Default"

You should mention the options somewhere

I had to take a look at the source to find out I could pass :secure as an option to image_url. Maybe you could mention that somewhere in the Wiki? It might make life a little bit easier for users. Not a big deal at all, of course.

Errno::ENAMETOOLONG: File name too lon

in rails console

url = Gravatar.new("[email protected]").image_data
Errno::ENAMETOOLONG: File name too long @ rb_sysopen - /home/tomi/rubyrubyruby/github/company/app_name/tmp/cache/gravatar-f6efe2ad4860e6774104c88114ad9dec-none%2Fhttp%3A%2F%2Fwww.gravatar.com%2Favatar%2Ff6efe2ad4860e6774104c88114ad9dec20140801-14666-1868pl1

ruby 2.1.1
rails 4.0.2 (I know I should upgrade :( )
gravatar-ultimate (2.0.0)

XMLRPC requirement

Howdy,

I believe the newer versions of Ruby have removed xmlrpc support. It's available as a gem though. Could the xmlrpc gem be added as a dependency of this gem?

Thanks!

How to: check if gravatar exists for email in Ruby

The Story

I have a mailer that will include a gravatar. I return to this awesome gem once again. I want a custom default icon to appear inline and embedded in an html email. Reason for being embedded is because I don't want the user to have to wait to load the resource from heroku if the app is "sleeping". If the device doesn't cache it, it will then be making multiple requests. Having it embedded would also make development easier. When specifying a default image with gravatar and this gem, gravatar makes an http request for your image and forwards it as their own. This is obviously not going to work for me.

The issue

There is no way for me to use this gem to check if a user has a gravatar image or not. Silly. However, I can specify gravatar to return a status header of 404 if there is no gravatar image for the user (or if they are not a user). Hmm...

Searching google

Searching google, I found this snippet. It seemed to work, though I didn't test it thoroughly. Credit goes to Henrik Nyh. http://henrik.nyh.se/2008/11/gravatar-check/

require 'net/http'
require 'digest/md5'
# Is there a Gravatar for this email? Optionally specify :rating and :timeout.
def gravatar?(email, options = {})
  hash = Digest::MD5.hexdigest(email.to_s.downcase)
  options = { :rating => 'x', :timeout => 2 }.merge(options)
  http = Net::HTTP.new('www.gravatar.com', 80)
  http.read_timeout = options[:timeout]
  response = http.request_head("/avatar/#{hash}?rating=#{options[:rating]}&default=http://gravatar.com/avatar")
  response.code != '302'
rescue StandardError, Timeout::Error
  true  # Don't show "no gravatar" if the service is down or slow
end

My solution

This inspired me to come up with my own solution. I choose to use httparty, though I'm sure you can do it without if you choose. https://github.com/jnunemaker/httparty

if HTTParty.get(Gravatar.new(@user.email).image_url :default => 404).code == 404

It's as simple as that. Rework the if statement however you like to fit your situation. If there is no gravatar image, it will return true. Then do whatever you wish.

PS Adding this feature to the gem would be wonderful. ;)

gravatar broken on ruby 1.9 rails 2.3.14

this line in dependencies.rb is incorrect:

  Rails.configuration.gem "sc-core-ext", ">= 1.2.0"

this should be (I think):

Rails.configuration.gem "sc-core-ext", :version => ">= 1.2.0"

the bad code ends up triggering "sc-core-ext"[:requirement], which harmlessly returns nil in ruby 1.8, but throws in ruby 1.9.

Readme gem install typo!

Hey there,

I was just getting going with it, and copied and pasted from the readme for my Gemfile, but it couldn't find the gem. I realized it's just spelled wrong โ€“

gem install gravitar-ultimate

should be

gem install gravatar-ultimate

Set default image if user doesn't have Gravatar

I did not see anywhere in your docs how to override the ugly blue "G" that gravatar serves if the user email is not in the system. Can I check if the default image is going to come back and if so, serve a local image as a default instead of the blue "G"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.