Created
July 19, 2010 12:19
-
-
Save Arcath/481321 to your computer and use it in GitHub Desktop.
gravatar avatar url generating helper method, simply pass an email to it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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