squeaknode/squeaknode/admin/profile_image_util.py
Jonathan Zernik 930c1ff20c
Show custom user avatar (#740)
* Use material avatar in timeline avatar

* Load default profile image from static file

* Include base64 image in squeak display entry response

* Got default profile image working
2021-01-28 22:37:55 -08:00

12 lines
302 B
Python

import base64
from pkg_resources import resource_stream
def load_default_profile_image():
return resource_stream(__name__, 'default_profile_image.jpg').read()
def bytes_to_base64_string(data: bytes) -> str:
encoded_string = base64.b64encode(data)
return encoded_string.decode('utf-8')