2.5 Using ImageCache Presets with AvatarBlocks

By default, the AvatarBlocks module will display user pictures as they exist in your Drupal installation. The module itself does not attempt to resize or crop the image in any way. Unless you have a very consistently-sized collection of avatars, this can result in a block with user pictures of all shapes and sizes. Maybe that's the look you're going for. But more likely, you'll want the blocks to display pictures that are of the same size and shape.

Using the ImageCache module, you can transform the user pictures before they are displayed in the blocks. You could, for example, crop the pictures to a square shape and scale the pictures to a fixed size. This will result in consistently-sized pictures that line up nicely in the block display.

Imagecache Presets

To use the ImageCache module with AvatarBlocks, you must create an ImageCache Preset. A preset is a sequence of actions to perform on an image. Once you have created a preset, you can choose to apply that preset to the avatars displayed by each of the blocks.

Once you've created a preset that will transform the avatars as you wish, you can select that preset on each of the block configuration pages. Each block can use a different Imagecache preset, allowing you to have different transformations of the same image in different blocks.

For the blocks on this demo site, we created an ImageCache preset with the following actions:

  • Scale - width: 50, height: 50, fit: Outside dimensions
  • Crop - width: 50, height: 50, xoffset: center, yoffset: top