trello API gives only hashes, such as avatarHash
, gravatarHash
, uploadedAvatarHash
etc. Is there any way to retrieve an image url from these hashes?
trello API gives only hashes, such as avatarHash
, gravatarHash
, uploadedAvatarHash
etc. Is there any way to retrieve an image url from these hashes?
4 Answers
Reset to default 5Trello uses Gravatar, so the hash you're getting back relates directly to that.
Base URL would be: http://www.gravatar./avatar/
You can add on jpg and size between 1 and 512.
An example:
http://www.gravatar./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./avatar/' + hash + '.jpg?s=' + size;
}
Using this hash you can retrieve an image by url: http://trello-avatars.s3.amazonaws./${avatarHash}/50.png
As at 14 July 2020 the correct URL path is as follows:
https://trello-members.s3.amazonaws./{member.id}/{member.avatarHash}/{size}.png
Note: this doesn't seem to work any arbitrary size value, however it does work for size = 170.
Alas, as of 2020-05-05, both these answers don’t work.
gravatarHash
solution works to get an avatar from Gravatar, but I’m not sure that solution ever worked as stated from the Trello API’s returnedavatarHash
, as the Trello API returns an opaqueavatarHash
which is NOT the same as agravatarHash
. According to Gravatar APis they are a trimmed, lowercased, MD5’ed email address. SogravatarHash
≠ TrelloavatarHash
.https://trello-avatars.s3.amazonaws./{avatarHash}/50.png
now 403s. Trello devs made a change.
New solution:
Use https://trello-members.s3.amazonaws./{id}/{avatarHash}/50.png
Where {id}
is the member/user id and {avatarHash}
is the same retrieved from the Trello API. That same API allows you to specify returning id
as well, so add that to the list of fields with the API call.
In validating by looking at avatars on Trello. they do, in fact, only seem to use this trello-members
URL.
This is returned in the same data response if you add the field avatarUrl
.
I have updated our Gmail-2-Trello Chrome Extension (https://g2t.pub/chrome) and it’s working correctly with this new pattern.