initial
This commit is contained in:
17
web/views/profile_photo.py
Normal file
17
web/views/profile_photo.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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"
|
||||
)
|
Reference in New Issue
Block a user