|
@@ -22,14 +22,19 @@ class ImagesManager(models.Manager):
|
|
|
img = Image.open(fullname)
|
|
|
width, height = img.size
|
|
|
# 缩略图压缩宽或高最大200
|
|
|
- if width > 200 or height > 200:
|
|
|
- if width > height:
|
|
|
- size = (200, int(height * 200 / width))
|
|
|
- elif width < height:
|
|
|
- size = (int(width * 200 / height), 200)
|
|
|
- else:
|
|
|
- size = (200, 200)
|
|
|
- img = img.resize(size, Image.ANTIALIAS)
|
|
|
+ # if width > 200 or height > 200:
|
|
|
+ # if width > height:
|
|
|
+ # size = (200, int(height * 200 / width))
|
|
|
+ # elif width < height:
|
|
|
+ # size = (int(width * 200 / height), 200)
|
|
|
+ # else:
|
|
|
+ # size = (200, 200)
|
|
|
+ # img = img.resize(size, Image.ANTIALIAS)
|
|
|
+ # img.save(fullname)
|
|
|
+ # width, height = img.size
|
|
|
+
|
|
|
+ if width > 1440:
|
|
|
+ img = img.resize((1440, int((height / width) * 1440)), Image.ANTIALIAS)
|
|
|
img.save(fullname)
|
|
|
width, height = img.size
|
|
|
except:
|