diff --git a/BackEnd/images/views.py b/BackEnd/images/views.py index 401986da5..9976a1c70 100644 --- a/BackEnd/images/views.py +++ b/BackEnd/images/views.py @@ -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(