Skip to content

Commit

Permalink
view updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Lvyshnevska committed Jun 20, 2024
1 parent 6f870f2 commit bf15aaf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions BackEnd/images/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,10 @@ def get_serializer_context(self):

def perform_create(self, serializer):
image = serializer.validated_data.get("image_path")
if image:
image_size = image.size
with Image.open(image) as img:
content_type = img.format
hash_md5 = md5(img.tobytes()).hexdigest()
else:
image_size = None
content_type = ""
hash_md5 = ""
image_size = image.size
with Image.open(image) as img:
content_type = img.format
hash_md5 = md5(img.tobytes()).hexdigest()
user = self.request.user
image_type = self.kwargs.get("image_type")
serializer.save(
Expand Down

0 comments on commit bf15aaf

Please sign in to comment.