keybase / client

Keybase Go Library, Client, Service, OS X, iOS, Android, Electron
BSD 3-Clause "New" or "Revised" License
8.91k stars 1.23k forks source link

Picture API #242

Closed gabriel closed 9 years ago

gabriel commented 9 years ago

I think we should an api call: https://keybase.io/_/api/1.0/{username}/picture?type=normal (this redirects to the picture)

Then we don't need to include it in the RPC and the daemon doesn't have to worry about photos and we can have user objects thin by default.

Kind of like facebook https://developers.facebook.com/docs/graph-api/reference/v2.2/user/picture

For example, zuck is id=4: http://graph.facebook.com/4/picture?type=normal

Benefits:

Probably should have done this first and we wouldn't have had to do this in the RPC? Oops :)

maxtaco commented 9 years ago

Interesting. The one concern is what if people are going through a proxy or over Tor?

maxtaco commented 9 years ago

Also, how would this work on local vs. live testing?

maxtaco commented 9 years ago

Ok, we'll whip up an API and punt on the proxy/Tor issues here for now. We should revisit.

maxtaco commented 9 years ago

@gabriel what if there's no picture? should we 404 or show the default doggie?

gabriel commented 9 years ago

404 is good

On Wed, Mar 4, 2015 at 4:35 PM, Maxwell Krohn notifications@github.com wrote:

@gabriel https://github.com/gabriel what if there's no picture? should we 404 or show the default doggie?

— Reply to this email directly or view it on GitHub https://github.com/keybase/client/issues/242#issuecomment-77282543.

maxtaco commented 9 years ago

@malgorithms, do you mind handling this one?

malgorithms commented 9 years ago

yeah, I'll have this done this morning.

malgorithms commented 9 years ago

ok, this is live. There are 2 formats for every user right now: square_200, and square_40. The square_200 is the default image if you don't ask for one of the formats.

Also, if you note the URL structure, I don't present it as an "API" call - this is just a matter of preference, but like chris/key.asc, I like the non API looking URL.

Anyway, some examples:

These 302

https://keybase.io/chris/picture (uses default, which is configurable server-side) https://keybase.io/chris/picture?format=square_200 https://keybase.io/chris/picture?format=square_40

These 404

https://keybase.io/chris/picture?format=fake_format https://keybase.io/shitbag1000/picture (user doesn't exist) https://keybase.io/cloudflare/picture (user exists but doesn't have a picture)

If we need other formats, let me know. We should try to make as few as possible and do resizing client-side. For example, in the browser I typically use the 200x200 for small thumbs, and it looks good for retina and regular screens.

Obviously that doesn't work if a client can't rescale or does shitty (nearest-neighbor) interpolation. In which case I can add a format.

Reopen if you need anything else.