Configuring Gravatars

Introduction

Gravatars stands for Generally Recognized Avatars: people reading and commenting blogs don't have to register to each blog they read, and complete their profile with an avatar image. Instead they can register on Gravatar.com or other similar services and they can upload one single image to be displayed as avatar on all the blogs that support that feature, such as SubText.
The user is globally recognized by its email address.

Configuration

To use that feature you must enable and configure it correctly.
And this require two steps:

  1. Choose a skin that supports Gravatars.
    Or if your favourite skin doesn't support it, adding gravatar is easy: just slap in the following code in the comments.aspx template: you can also specify a default image for users that don't have a gravatar

    <asp:Image runat="server" id="GravatarImg"
    visible="False" width="50px"
    PlaceHolderImage="~/images/shadow.gif"></asp:Image>

    Also is important that the comment submission form asks the user for its email address

  2. Modify web.config to enable and configure Gravatars. Here is the snippet from web.config file:

    <add key="GravatarEnabled" value="false"/>
    <!-- uncomment to use email2face.com
    <add key="GravatarUrlFormatString"
    value="http://www.email2face.com/lookup/{0}" />

    -->
    <add key="GravatarUrlFormatString"
    value="http://www.gravatar.com/avatar.php?
    gravatar_id={0}&amp;size=50&amp;
    default=default_gravatar.png"
    />
    <add key="GravatarEmailFormat" value="MD5" />

    Let's see what each parameter is about:

    • GravatarEnabled: obviously, true to enable gravatars, false to disable;
    • GravatarUrlFormatString: the remote url for get the image from. Is a format string and must contain a {0} that will be replaced with the email of the user;
    • GravatarEmailFormat: how the mail should be formatted, plain or hashed with MD5.

    SubText supports two source of gravatars:

    • Gravatar.com whose format string is http://www.gravatar.com/avatar.php?gravatar_id={0}&size=50
      &default=http%3A%2F%2Fwww.somesite.com%2Fsomeimage.jpg
    • email2Face.com, whose format is http://www.email2face.com/lookup/{0}

     

Subtext Logo design by TurboMilk.