Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
0.3
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

cbs_gravatar

Description

This is a simple, clean plugin to display gravatars in comment forms. It doesn’t use any cache and provides access to all Gravatar options.

It outputs an <img> tag. If wanted, the image can be linked to the commenter’s website.

Why another gravatar plugin ?

Just because the existing one was too complex for my needs (using a caching library, etc.) and I wanted a straightforward implementation, and also because I wanted the functionality of linking the gravatar image to the commenter’s website if the commenter provided it. It is actually possible to link an image with <txp:comment_web />, but then the link is displayed in all cases, even if the commenter entered no website address. This plugin creates the link only if the commenter entered its website address.

Syntax

In a comment form:

<txp:cbs_gravatar />

Attributes

Required

none.

Optional

  • default: Absolute URL of the default image to display when the commenter has no gravatar. This default image is never resized, so make sure it has the same size as size (see below) for a consistent display. When not specified, Gravatar will return a 1×1 pixel GIF image.
  • size: The square size of the gravatar image, in pixels (numeric value in the range 1 to 80). Gravatar will resize the default 80×80 pixels image to this size, using bicubic resizing. When not specified, it will return the image in its original size of 80×80 pixels.
  • rating: Either ‘G’, ‘PG’, ‘R’ or ‘X’. The commenter’s gravatar will be displayed if it does not exceed the specified rating, otherwise the default image will be shown (see above). By default, all gravatars are shown without restriction.
  • border: Hexadecimal value of the color of a 1px border to be overlaid on the gravatar (example: FF0000). Default is no added border.
  • alt: Alternative text for the image. Default is empty.
  • class: CSS class attribute for the <img> tag, default is no class attribute.
  • link: When set to true, the image will be linked to the commenter’s website (if available). The link will have a “nofollow” attribute if specified in the Textpattern advanced options. Default is false.

Changes history

v0.3 (2008-11-15)

  • Code cleaning, no more warnings.

v0.2 (2006-09-27)

  • Now the plugin sets the “width” and “height” attributes on the XHTML img tag, for a more coherent display during image loading.
  • Code cleaning.

v0.1 (2006-06-28)

Initial release.

Article Request Count:
Initially released:
2006-06-28
Posted here:
27 Jun 2006

You know you want to visit the Archives.
Published with Textpattern