npm

Need private packages and team management tools?Check out npm Orgs. »

gravatar-url

3.1.0 • Public • Published

gravatar-url Build Status

Get the URL to a Gravatar image from an identifier, such as an email

Install

$ npm install gravatar-url

Usage

const gravatarUrl = require('gravatar-url');
 
gravatarUrl('sindresorhus@gmail.com', {size: 200});
//=> 'https://gravatar.com/avatar/d36a92237c75c5337c17b60d90686bf9?size=200'

API

gravatarUrl(identifier, options?)

identifier

Type: string

Identifier for which to get the Gravatar image.

This will typically be an email matching a Gravatar profile, but can technically be any string.

The Gravatar service only sees a hash of the identifier, so you could actually use this to get pseudo-random avatars for any entity, e.g. based on its ID.

Note that if the identifier contains an @, it is assumed to be an email, and will therefore be lower-cased and trimmed before hashing, as per the Gravatar instructions - otherwise it will be hashed as-is.

options

Type: object

size

Type: number
Default: 80
Values: 1..2048

Size of the image.

default

Type: string
Default: This image
Values: Custom URL or 404, mm, identicon, monsterid, wavatar, retro, blank

Image to return if the identifier didn't match any Gravatar profile.

rating

Type: string
Default: g
Values: g pg r x

Allowed rating of the image.

Related

install

npm i gravatar-url

Downloadsweekly downloads

3,269

version

3.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability