summaryrefslogtreecommitdiff
path: root/app/photos/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/photos/forms.py')
-rw-r--r--app/photos/forms.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/photos/forms.py b/app/photos/forms.py
index f0b87e8..1f80496 100644
--- a/app/photos/forms.py
+++ b/app/photos/forms.py
@@ -49,6 +49,7 @@ class GalleryForm(forms.ModelForm):
self.fields['images'].choices = items
self.fields['images'].allow_tags = True
+
class UploadZipForm(forms.Form):
"""
Handles the uploading of a gallery of photos packed in a .zip file
@@ -193,11 +194,16 @@ class UploadZipForm(forms.Form):
count += 1
img = Image.open(image.image.path)
base_path = "%s/galleries/" % settings.IMAGES_ROOT
- resize_image(img, 2280, None, 65, base_path+'large/', image.get_image_name())
- resize_image(img, 1140, None, 72, base_path+'medium/', image.get_image_name())
- resize_image(img, 720, None, 68, base_path+'small/', image.get_image_name())
- resize_image(img, 160, None, 68, base_path+'thumb/', image.get_image_name())
+ if img.size[0] > img.size[1]:
+ resize_image(img, 2280, None, 65, base_path+'large/', image.get_image_name())
+ resize_image(img, 1140, None, 72, base_path+'medium/', image.get_image_name())
+ resize_image(img, 720, None, 68, base_path+'small/', image.get_image_name())
+ if img.size[1] > img.size[0]:
+ resize_image(img, None, 1600, 65, base_path+'large/', image.get_image_name())
+ resize_image(img, None, 800, 72, base_path+'medium/', image.get_image_name())
+ resize_image(img, None, 460, 60, base_path+'small/', image.get_image_name())
+ resize_image(img, 160, None, 68, base_path+'thumb/', image.get_image_name())
zipper.close()
if request: