ColdFusion Image Requests

← Back

Contributed by Rob Cameron

Although there isn't a plugin available for ColdFusion, it is extremely easy to code yourself. ColdFusion has a function available which will automatically create an MD5 Hash of any string you specify. This means that you simply create the link to the gravatar yourself and include the poster's email address inside the #lcase(Hash(lcase()))# functions.


<img src="" />

Where user_email is the email of the poster that you want to retrieve the gravatar for.

If you wish to restrict your gravatars to R rated and below, your link would look like this:

<img src="" />

If you want R rated gravatars and below, and you want to use your own 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:

<img src="" />

And, of course, let's not forget to add an alt attribute:

<img src="" alt="#user_name#'s Gravatar" />

For extra credit you could even create a custom tag for yourself that would output the entire image tag.