Code Monkey home page Code Monkey logo

ngx-gravatar's Introduction

npm version GitHub stars CI Testing codecov npm npm bundle size (minified + gzip) code style: prettier license

ngx-gravatar

The gravatar directive for Angular applications.

This directive supports two avatar sources:

  • Custom image
  • Gravatar

By default, the custom image has higher priority. If it is invalid, the Gravatar will be used. The priority can be changed by setting preferGravatar input or override the default configuration (see below).

Angular Gravatar Directive

Visit here for more information about Gravatar.

Demo

Live demo here.

If you like ngx-gravatar, please give it a ⭐ on github

Installation

Install ngx-gravatar via NPM, using the command below.

npm install --save ngx-gravatar
# or
yarn add ngx-gravatar
Angular Installation command
Angular 13 npm i --save ngx-gravatar
Angular 11 npm i --save [email protected]
Angular 10 npm i --save [email protected]
Angular 9 npm i --save [email protected]
Angular 8 npm i --save [email protected]
Angular 6 & 7 npm i --save [email protected]
Angular 4 & 5 npm i --save [email protected]

See full documentation here

ngx-gravatar's People

Contributors

angular-cli avatar darkv avatar t-ho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-gravatar's Issues

Support input parameter "hash"

A nice feature would be to be able to pass the email hash value instead of the email if you already have that value at hand. This could be either by adding a new input parameter or letting the module detect if the value passed in for the existing email parameter is already an MD5 hash.

Bind error

When attempting to set this up, I get the following message to the console:

Uncaught Error: Template parse errors:
Can't bind to 'email' since it isn't a known property of 'img'.
<img ngxGravatar [ERROR ->][email]="user.email" [src]="user.avatar" class="img-thumbnail rounded-circle" alt="">

possible 404 bug with unregistered email

Describe the bug
When loading a webpage with a user's email that is not currently registered to a Gravatar account, we get a 404 error in the console that appears to be generated from the library. A default Gravatar is still generated and renders successfully in the browser. Aside from the console error, ngx-gravatar appears to work successfully. We are importing the library and passing the user's profile. None of the inputs are being used.

To Reproduce
Steps to reproduce the behavior:

  1. Submit unregistered email to Gravatar using ngx-gravatar lib
  2. Check console for error

Expected behaviour
No errors in the console with a renderer Gravatar.

Screenshots

image

Desktop (please complete the following information):

  • OS: macOS 10.15.6
  • Browser [chrome]
  • Version [85.0.4183.102]

Additional context

Crashes when offline

When theres no internet connection, it sends like 100 requests per second, trying to find the gravatar servers.

Crome warning: "cookie associated with a cross-site resource"

Hey there,

thank you for this easy to use module.

Got a Chrome warning because of missing attributes while setting cookie:

A cookie associated with a cross-site resource at https://gravatar.com/ was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

angular Version: 8.2.x
ngx-gravatar Version: 8.0.0
Chrome Version: Version 78.0.3904.108 (Official Build) (64-Bit)
OS: Mac OSX 10.15

Electron issue

When used with combination of electron and angular, there is issue with protocol.
It is not set to neither https or http but "//" and image can't be downloaded.

Entry point 'ngx-gravatar' contains deep imports

Hi. I have a warning using ivy the message is

"Entry point 'ngx-gravatar' contains deep imports into 'node_modules/ts-md5/dist/md5'"

Can we fixed this? I think ivy doesn't like deep imports.

I think this is the issue.

Untitled

Strange service export

Hello!

Thank you for this module. I would like to ask one question, I'm using this module probably in some not-standard way, like this:

import { ɵb } from "ngx-gravatar";

@Component({
  selector: 'user-component',
  templateUrl: 'user.component.html'
})
export class UserComponent {

  constructor(private ngxGravatarService: ɵb) {
  }

  getAvatarUrl(): String {
    return this.ngxGravatarService.generateGravatarUrl(this.authService.currentUser.email);
  }

// .....

}

My question is regarding this alias "import { ɵb }", it comes from a file node_modules/ngx-gravatar/ngx-gravatar.d.ts:

/**
 * Generated bundle index. Do not edit.
 */
export * from './public-api';
export { GRAVATAR_CONFIG_TOKEN as ɵc } from './lib/gravatar-config.token';
export { NgxGravatarDirective as ɵa } from './lib/ngx-gravatar.directive';
export { NgxGravatarService as ɵb } from './lib/ngx-gravatar.service';

Is there any way to remove these aliases, like NgxGravatarService as ɵb.

Best regards,
Alexey Zhokhov.

Rounding not applied in Firefox

When using this library, it works wonderfully in every browser except Firefox. On Firefox, the icon is square regardless of settings.

Support for hi-res monitors.

First of all—thanks for putting this together!

To support hi-res monitors/phones, can the requested image size be separate from the img display size? Even when I hard-coded a width/height, the values get overridden.

<img width=40 size="80"...>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.