newinternetlabs / new-internet-extension

https://newinternetextension.com
Other
14 stars 4 forks source link

[Question] Best practice for showing profile image #23

Open friedger opened 4 years ago

friedger commented 4 years ago

There are some solutions out there to show the profile picture of the user:

What is best practice for loading the profile image of the current user?

njordhov commented 4 years ago

Another way to show the profile image from the avatarUrl of the Blockstack SDK is to:

  1. Fetch the avatarUrl image as a blob at time of rendering, with cors enabled,
  2. Use URL.createObjectURL to create a blob url for the loaded image.
  3. Inject the blob url as the src of an image element.

The dCrypt and Dappity apps both fetch the avatar image as above. I used a proxy in the REBL-Stack/starter-app for now, mainly to minimize the required changes to the code and keep it simple.

See also #1 Gaia Can't Be Evil