JS Gravatar
Vanilla JS
Copy dist/js-gravatar.js into your library folder Load it into your HTML script
You can use the UNPKG link https://unpkg.com/js-gravatar@1.1.2/dist/js-gravatar.js
. Remember to update the package number to the most recent.
Call the method with its options.
;
With npm (and CommonJS builder)
Install with npm.
npm install --save js-gravatar
Install with yarn.
yarn add js-gravatar
import the library
ES5
const JsGravatar = ;
ES6
;
Call the method
;;
Parameter Definitions
email
: Email address of the user to generate gravatar for - stringmd5Hash
: Optional: MD5 hash of the email above. If email is provided, md5hash will be ignored. If neither email nor md5hash is provided, the library will throw en error - stringsize
: Optional: The size of the image to be displayed. Should be from 1 to 2048 - numberdefaultImage
: What image should be used if email does not have a gravatar. See options below - string
Defaultimage Options - ['404', 'mp', 'identicon', 'monsterid', 'wavatar', 'retro', 'robohash', 'blank']
License
MIT License