Commits

Anonymous committed 3363e1a

Add get_max_image_sizes function

Comments (0)

Files changed (1)

     if storage.exists(filename):
         filename = gen_filename(name, storage)
     return filename
+
+
+def get_max_image_sizes(images, attr='image'):
+    width = max([getattr(img, attr).width for img in images])
+    height = min([getattr(img, attr).height for img in images if getattr(img, attr).width == width])
+    return {'height': height, 'width': width}