7.1.4 A Gravatar image and a sidebar

Having defined a basic user page in the previous section, we’ll now
flesh it out a little with a profile image for each user and the first
cut of the user sidebar. When making views, we’ll focus on the visual
appearance and not worry too much about the exact structure of the page,
which means that (at least for now) we won’t be writing tests. When we
come to more error-prone aspects of view, such as pagination (Section
9.3.3), we’ll resume test-driven development.

We’ll start by adding a “globally recognized avatar”, or Gravatar, to
the user profile.6 Originally created by Tom Preston-Werner (cofounder
of GitHub) and later acquired and scaled by Automattic (the makers of
WordPress), Gravatar is a free service that allows users to upload
images and associate them with email addresses they control. Gravatars
are a convenient way to include user profile images without going
through the trouble of managing image upload, cropping, and storage; all
we need to do is construct the proper Gravatar image URL using the
user’s email address and the corresponding Gravatar image will
automatically appear.7

Our plan is to define a gravatar_for helper function to return a
Gravatar image for a given user, as shown in Listing 7.12.