def getThumbnail(user): # try returning image URL at user home node if isinstance(user, User): openid = user.profile.openid() if openid is not None: url = 'http://%s%s?openid=%s&thumbnail=true' % ( user.profile.site.domain, reverse('user_image'), openid) return url # default: return image path on local system imagePath = getImage(user) thumbnailPath = getThumbnailPath(imagePath, mustExist=True) return thumbnailPath
def getThumbnail(user): # try returning image URL at user home node if isinstance(user, User): openid = user.profile.openid() if openid is not None: url = 'http://%s%s?openid=%s&thumbnail=true' % (user.profile.site.domain, reverse('user_image'), openid) return url # default: return image path on local system imagePath = getImage(user) thumbnailPath = getThumbnailPath(imagePath, mustExist=True) return thumbnailPath
def getThumbnailById(id, type): if id is not None: if type == 'Collaborator': obj = Collaborator.objects.get(pk=id) elif type == 'Organization': obj = Organization.objects.get(pk=id) elif type == 'FundingSource': obj = FundingSource.objects.get(pk=id) return getThumbnail(obj) else: imagepath = getattr(settings, "STATIC_URL") + DEFAULT_IMAGES[type] return getThumbnailPath(imagepath)