Gravatar Images

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from django import template

import urllib, hashlib

register = template.Library()

def gravatar(user, size=80):
    gravatar_url = "http://www.gravatar.com/avatar.php?"
    gravatar_url += urllib.urlencode({
        'gravatar_id':hashlib.md5(user.email).hexdigest(),
        'size':str(size)})
    return """<img src="%s" alt="gravatar for %s" />""" % (gravatar_url, user.username)

register.simple_tag(gravatar)

More like this

  1. Gravatar support for Django comments by jonathan 4 years, 7 months ago
  2. Full Featured Gravatar Tag by ashcrow 4 years, 5 months ago
  3. Captcha without Freetype or the Python Imaging Library (PIL) by gregb 3 years, 11 months ago
  4. Template Tag to protect the E-mail address by nitinhayaran 3 years, 3 months ago
  5. Ordered items in the database by Leonidas 6 years ago

Comments

(Forgotten your password?)