Skip to content

Instantly share code, notes, and snippets.

@gertig
Forked from Arcath/gist:481321
Created February 8, 2011 20:46
Show Gist options
  • Save gertig/817199 to your computer and use it in GitHub Desktop.
Save gertig/817199 to your computer and use it in GitHub Desktop.
def gravatar_url(email,options = {})
require 'digest/md5'
hash = Digest::MD5.hexdigest(email)
url = "http://www.gravatar.com/avatar/#{hash}"
options.each do |option|
option == options.first ? url+="?" : url+="&"
key = option[0].to_s
value = option[1].to_s
url+=key + "=" + value
end
url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment