Using Gravatars

Gravatar is a free service that lets you associate a profile picture with your email address. Gravatar makes each user’s profile image available via a specially formatted URL. For example, Figure 18.3 shows the Gravatar of one of our test accounts.

Figure 18.3  Gravatar image example

Gravatar image example

See the end of the URL? That is a unique identifier generated from the user’s email address. This identifier is called a hash and is easy to generate with the help of a third-party library called crypto-js.

Add crypto-js to your project using npm:

npm install --save-dev crypto-js

crypto-js is now installed in your project’s ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.