Created
January 2, 2014 22:27
-
-
Save iotaweb/8228276 to your computer and use it in GitHub Desktop.
gravatar Image service for AngularJS (uses md5 factory - see other gist)
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
//! gravatarImageService | |
.factory('gravatarImageService', function(md5) { | |
return { | |
getImageSrc: function(value, size, rating, defaultUrl, secure) { | |
// convert the value to lower case and then to a md5 hash | |
var hash = md5.createHash(value.toLowerCase()); | |
var src = (secure ? 'https://secure' : 'http://www') + '.gravatar.com/avatar/' + hash + '?s=' + size + '&r=' + rating + '&d=' + defaultUrl; | |
return src; | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment