ColdFusion Image Requests

← Back

Contributed by

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.

Usage:

<img src="https://www.gravatar.com/avatar/#lcase(Hash(lcase(user_email)))#" />

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="https://www.gravatar.com/avatar/#lcase(Hash(lcase(user_email)))#?r=R" />

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="https://www.gravatar.com/avatar/#lcase(Hash(lcase(user_email)))#?r=R&d=http%3A%2F%2Fwww.yoursite.com%2Fsomeimage.jpg" />

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

<img src="https://www.gravatar.com/avatar/#lcase(Hash(lcase(user_email)))#?r=R&d=http%3A%2F%2Fwww.yoursite.com%2Fsomeimage.jpg" alt="#user_name#'s Gravatar" />

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

吉林快3代理 智慧彩票投注 鼎鑫彩票注册 500彩票网 小米彩票是真的吗 亿信彩票平台 小米彩票代理 小米彩票技巧 99棋牌 幸运时时彩