Skip to content

🖼 A library to generate gravatar image url.

License

Notifications You must be signed in to change notification settings

xn-02f/gravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gravatar

Actions npm LICENSE

🖼 Gravatar is a node library to generate gravatar image url.

Install

Via npm :

$ npm i @xn-02f/gravatar

Usage

const gravatar = require('@xn-02f/gravatar');
// import gravatar from '@xn-02f/gravatar'

const email = '[email protected]';
const options = {size: '80', default: '404'};
gravatar(email, options);
Parameter Description
email string
The gravatar email url.
options object
Query string options. Like: size, default, rating, forcedefault and others.

About options parameter

Property Alias Default Description
size s 80 Request a specific image size, which will be dynamically delivered from Gravatar and passing a single pixel dimension.
(since the images are square)
default d defaultImage Set default image when an email address has no matching Gravatar image.
Gravatar has a number of built in options:
404 do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response.
mp mp
identicon identicon
monsterid monsterid
wavatar wavatar
retro retro
robohash robohash
blank blank
forcedefault
(Unrecommend)
f (null) If for some reason you wanted to force the default image to always load, you can do that by using the parameter, and setting its value to y.
Before: before
After: after
rating r g This property allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience.
you can specify one of the following ratings to request images up to and including that rating:
g: suitable for display on all websites with any audience type.
pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
x: may contain hardcore sexual imagery or extremely disturbing violence.

License

MIT



© 2024   |   xn-02f

About

🖼 A library to generate gravatar image url.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •