Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve user avatar from a Trello API?

trello API gives only hashes, such as avatarHash, gravatarHash, uploadedAvatarHash etc. Is there any way to retrieve an image url from these hashes?

like image 435
mcmxc Avatar asked Dec 29 '25 00:12

mcmxc


1 Answers

Trello uses Gravatar, so the hash you're getting back relates directly to that.

Base URL would be: http://www.gravatar.com/avatar/

You can add on jpg and size between 1 and 512.

An example:

http://www.gravatar.com/avatar/ [the hash here] .jpg?s=80

Will give back 80px avatar

function get_gravatar(hash, size) {           
    var size = size || 80;

    return 'http://www.gravatar.com/avatar/' + hash + '.jpg?s=' + size;
}
like image 81
zerohero Avatar answered Dec 30 '25 14:12

zerohero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!