:art: Not make thumbnail when both width and height lte

huangqimin001 5 miesięcy temu
rodzic
commit
0a9524c13c
1 zmienionych plików z 2 dodań i 0 usunięć
  1. 2 0
      utils/thumbnail_utils.py

+ 2 - 0
utils/thumbnail_utils.py

@@ -32,6 +32,8 @@ def make_thumbnail2(data, w=360, h=240):
32 32
     im = Image.open(BytesIO(data))
33 33
     fmt = im.format.lower()
34 34
     width, height = im.size
35
+    if width <= w and height <= h:
36
+        return data
35 37
     if width > height:
36 38
         thumb_width, thumb_height = w, height * w / width
37 39
     else: