MovableType Image Requests

← Back

Plugin

A plugin is available for MovableType 2.6.x and 3.0 installations. The plugin makes available a tag called MTGravatar that, when used inside the MTComments tag, outputs the correct gravatar URL based on the commenters email address.

Download mt_gravatar.zip

Installation: Download and extract the above file to your MovableType plugins directory, located at /plugins. Once the file is placed in the plugins directory, it is immediately available for use in your template files.

Usage: MTGravatar has the following syntax:

<$MTGravatar {rating="[G | PG | R | X]" } {size="[1..80]"} {default="full URL of default image"} $>

All attributes are optional. For example, the following will create a gravatar URL that allows all rating levels, is 80×80 pixels and uses no default image:

<$MTGravatar$>

If you wish to restrict your gravatars to G rated only, you'd do this:

<$MTGravatar rating="G"$>

If you want the size of the image changed as well, supply the pixel dimension as an additional attribute:

<$MTGravatar rating="G" size="40"$>

If you want G rated gravatars only and you want to use your own "Big Bird" image as a default graphic (shows up when either no gravatar exists for a given user, or the given user's gravatar exceeds the specified rating), you'd do this:

<$MTGravatar rating="G" default="http://www.somewhere.com/bigbird.jpg"$>

Remember that this only generates the URL, so you have to place the tag inside the src attribute of an img tag like so:

<img src="<$MTGravatar$>" alt="" />

CommentBodyPlusGravatar Plugin

Also available for MovableType 2.6.x and 3.0 installations, this plugin makes available a tag called MTCommentBodyPlusGravatar that, when used inside the MTComments tag as a replacement for MTCommentBody, outputs the comment body and inserts the gravatar image code inside the opening <p> tag. This is important if you want to use CSS to float the image so that text will wrap around it.

Download mt_gravatar_injector.zip

Installation: Download and extract the above file to your MovableType plugins directory, located at /plugins. Once the file is placed in the plugins directory, it is immediately available for use in your template files.

Usage: MTCommentBodyPlusGravatar has the following syntax:

<$MTCommentBodyPlusGravatar {convert_breaks="[0 | 1]"} {class="classname"} {rating="[G | PG | R | X]"} {size="[1..80]"} {default="full URL of default image"}$>

All attributes are optional. For example, the following will output the comment body and a gravatar image that allows all rating levels, is 80×80 pixels and uses no default image:

<$MTCommentBodyPlusGravatar$>

If you wish to restrict your gravatars to G rated only, you'd do this:

<$MTCommentBodyPlusGravatar rating="G"$>

If you want the size of the image changed as well, supply the pixel dimension as an additional attribute:

<$MTCommentBodyPlusGravatar rating="G" size="40"$>

If you want G rated gravatars only and you want to use your own "Big Bird" image as a default graphic (shows up when either no gravatar exists for a given user, or the given user's gravatar exceeds the specified rating), you'd do this:

<$MTCommentBodyPlusGravatar rating="G" default="http://www.somewhere.com/bigbird.jpg"$>

By default, the gravatar image tag will have a class of "gravatar" specified. You can target it with the CSS selector img.gravatar. If you want to change the class name, use the class attribute like this:

<$MTCommentBodyPlusGravatar class="myclass"$>

The convert_breaks parameter acts exactly as it does in MTCommentBody

Dynamic PHP Plugin

A plugin written by Chris Romp is available for MT 3.0+ installations with dynamic PHP functionality. This plugin makes available a tag called MTPHPGravatar that, when used inside the MTComments tag, outputs the correct gravatar URL based on the commenter's email address.

Download mtphp_gravatar.zip

Installation: Download and extract the above file to your MovableType plugins directory, located at /php/plugins. Once the file is placed in the plugins directory, it is immediately available for use in your template files.

Usage: MTPHPGravatar has the following syntax:

<$MTPHPGravatar {rating="[G | PG | R | X]" } {size="[1..80]"} {default="full URL of default image"}$>

All attributes are optional. For example, the following will create a gravatar URL that allows all rating levels, is 80×80 pixels and uses no default image:

<$MTPHPGravatar$>

If you wish to restrict your gravatars to G rated only, you'd do this:

<$MTPHPGravatar rating="G"$>

If you want the size of the image changed as well, supply the pixel dimension as an additional attribute:

<$MTPHPGravatar rating="G" size="40"$>

If you want G rated gravatars only and you want to use your own "Big Bird" image as a default graphic (shows up when either no gravatar exists for a given user, or the given user's gravatar exceeds the specified rating), you'd do this:

<$MTPHPGravatar rating="G" default="http://www.somewhere.com/bigbird.jpg"$>

Remember that this only generates the URL, so you have to place the tag inside the src attribute of an img tag like so:

<img src="<$MTPHPGravatar$>" alt="" />