18 lines
545 B
Python
18 lines
545 B
Python
from django.http import HttpResponse
|
|
|
|
from BaseLib.BaseView import BaseView
|
|
from BaseLib.minio import minio_client
|
|
|
|
|
|
class ProfilePhoto(BaseView):
|
|
required_login = True
|
|
endpoint = "profile_photo"
|
|
|
|
def get(self):
|
|
profile_photo_bytes = minio_client.get_object(f"profile_photos/{self.request.GET['id']}")
|
|
if profile_photo_bytes == b"":
|
|
profile_photo_bytes = open("content/empty_profile_photo.jpg", "rb").read()
|
|
return HttpResponse(
|
|
profile_photo_bytes, content_type="image/jpg"
|
|
)
|