From 28718d17d109ef45baa7f6831928f62975bdf8de Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Fri, 24 Jan 2020 13:02:22 +0300 Subject: [PATCH] aspect for crop --- apps/gallery/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/gallery/serializers.py b/apps/gallery/serializers.py index fb5bfa26..c777689c 100644 --- a/apps/gallery/serializers.py +++ b/apps/gallery/serializers.py @@ -98,7 +98,8 @@ class CropImageSerializer(ImageSerializer): x1, y1 = int(crop.split(' ')[0][:-2]), int(crop.split(' ')[1][:-2]) x2, y2 = x1 + width, y1 + height crop_params = { - 'geometry': f'{round(x2 - x1)}x{round(y2 - y1)}', + 'geometry': f'{round(x2 - x1)}x{round(y2 - y1)}' if 'certain_aspect' not in validated_data else + validated_data['certain_aspect'], 'quality': 100, 'cropbox': f'{x1},{y1},{x2},{y2}' }