allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8043] Add animated gif support for uploads
Date Tue, 16 Oct 2018 20:33:39 GMT
Repository: allura
Updated Branches:
  refs/heads/master 67d195824 -> b8e2f0d0f


[#8043] Add animated gif support for uploads


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/b8e2f0d0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b8e2f0d0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b8e2f0d0

Branch: refs/heads/master
Commit: b8e2f0d0f022ab8801bb0b89adae87bb7bca46bc
Parents: 67d1958
Author: Shalitha Suranga <shalithasuranga@gmail.com>
Authored: Thu Oct 11 10:47:13 2018 +0530
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Tue Oct 16 20:31:46 2018 +0000

----------------------------------------------------------------------
 Allura/allura/model/filesystem.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b8e2f0d0/Allura/allura/model/filesystem.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/filesystem.py b/Allura/allura/model/filesystem.py
index 3f2824c..325ec40 100644
--- a/Allura/allura/model/filesystem.py
+++ b/Allura/allura/model/filesystem.py
@@ -187,12 +187,16 @@ class File(MappedClass):
             return None, None
 
         format = image.format
+        save_anim = False
 
         if format == 'BMP' and convert_bmp: # use jpg format if bitmap is provided
             format = 'PNG'
             content_type = 'image/png'
             filename = re.sub('.bmp$', '.png', filename, flags=re.IGNORECASE)
- 
+
+        if format == 'GIF':
+            save_anim = True # save all frames if GIF is provided
+        
         if save_original:
             original_meta = original_meta or {}
             original = cls(
@@ -201,9 +205,9 @@ class File(MappedClass):
                 try:
                     if 'transparency' in image.info:
                         image.save(fp_w,
-                                   format, transparency=image.info['transparency'])
+                                   format, transparency=image.info['transparency'], save_all=save_anim)
                     else:
-                        image.save(fp_w, format)
+                        image.save(fp_w, format, save_all=save_anim)
                 except Exception as e:
                     session(original).expunge(original)
                     log.error('Error saving image %s %s', filename, e)


Mime
View raw message