gravatar.js 478 B

12345678910111213141516
  1. angular.module("noteWrangler")
  2. .provider('Gravatar', function GravatarProvider() {
  3. var avatarSize = 80; // px.
  4. const avatarUrlBase = "http://gravatar.com/avatar/";
  5. this.$get = function () {
  6. return function (email) {
  7. const hash = CryptoJS.MD5(email);
  8. const avatarUrl = avatarUrlBase + hash + "?size=" + avatarSize.toString();
  9. return avatarUrl;
  10. }
  11. };
  12. this.setSize = function (size) {
  13. avatarSize = size;
  14. };
  15. });