Swarm 2014.1: User Guide

Avatars

Swarm uses avatars, images that represent users responsible for events, in activity streams, projects, reviews, etc.

Avatars are retrieved from an avatar provider; the default provider is gravatar.com. Swarm sends an identifer to the avatar provider (for gravatar.com, an MD5 hash of the user's email address), and the provider returns the user's configured image (if one exists). If the requests fails for any reason, Swarm selects an avatar from its internal bee-themed collection.

You configure the avatar lookups with the avatars configuration block in the data/config.php file. Here is an example:

<?php
    // this block should be a peer of 'p4'
    'avatars' => array(
        'http_url'  => 'http://www.gravatar.com/avatar/{hash}?s={size}&d={default}',
        'https_url' => 'https://secure.gravatar.com/avatar/{hash}?s={size}&d={default}',
    ),

Both http_url and https_url specify URLs that should be used instead of the default gravatar.com URLs. Swarm picks which URL to use based on the current request; for HTTPS requests, Swarm picks the https_url URL. If the picked URL is not defined, Swarm will use gravatar.com.

Several replacement values are available for inclusion in the URLs:

{user}

The current Swarm userid, or empty string

{email}

The current Swarm user's email address, or empty string

{hash}

The MD5 hash of the Swarm user's email address, or 00000000000000000000000000000000 if no email address is configured

{default}

The value blank for a transparent GIF (allowing users without avatars to fallback to Swarm's internal bee-themed avatars) or the value mm for a mystery man used in circumstances where no user identifier is known.

{size}

the size Swarm would like in pixels for both the width and height, without units, e.g. 64

The URL you specify must include one of {user}, {email}, or {hash} to properly select a user-specific avatar. The URL should include {size} to assist Swarm's presentation. {default} is not necessary, but helps provide a consistent avatar experience.

Disable avatar lookups

If you wish to disable avatar lookups altogether and simply use Swarm's internal bee-themed avatars, set each URL to false. For example:

<?php
    // this block should be a peer of 'p4'
    'avatars' => array(
        'http_url'  => false,
        'https_url' => false,
    ),
0 matching pages