Created
October 17, 2013 13:11
-
-
Save dommmel/7024623 to your computer and use it in GitHub Desktop.
Retrieve Gravatar indenticon for a given email address via javascript. You need to include a md5 library (like http://www.myersdaily.org/joseph/javascript/md5-text.html)
This file contains 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
# get the url of an emails gravatar image | |
# | |
# default_image can either be an image url or one of the following: mm, identicon, monsterid, wavatar, retro, blank | |
# (See https://de.gravatar.com/site/implement/images/ for all options) | |
# | |
# Example usage: | |
# get_gravatar_image_url("example@example.com", 80, "retro") | |
get_gravatar_image_url = (hashed_email, size=80, default_image="mm", force_default=false) -> | |
size = (if (size >= 1 and size <= 2048) then size else 80) | |
"http://www.gravatar.com/avatar/#{hashed_email}?size=#{size}&d=#{encodeURIComponent(default_image)}" + (if force_default is true then "&f=y" else '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment