From 4dd6d7869e0b3fc44ae0a4a552fcc7d1601d279f Mon Sep 17 00:00:00 2001
From: Mikael Nordfeldth <mmn@hethane.se>
Date: Sun, 25 Jan 2015 22:10:57 +0100
Subject: [PATCH] Maybe we can detect animated files in core

---
 lib/default.php                           |  3 ++-
 lib/imagefile.php                         |  2 +-
 plugins/ImageMagick/ImageMagickPlugin.php | 11 ++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/default.php b/lib/default.php
index 42278612cd..b3918494ed 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -131,7 +131,8 @@ $default =
               'delete' => false,
               'move' => true),
         'image' =>
-        array('jpegquality' => 85),
+        array('jpegquality' => 85,
+              'resize_animated' => false),  // true doesn't mean we _can_, only that we will _try_ (plugins might do it)
         'avatar' =>
         array('server' => null,
               'dir' => INSTALLDIR . '/avatar/',
diff --git a/lib/imagefile.php b/lib/imagefile.php
index 0fe1c654b2..967519a950 100644
--- a/lib/imagefile.php
+++ b/lib/imagefile.php
@@ -52,7 +52,7 @@ class ImageFile
     var $height;
     var $width;
     var $rotate=0;  // degrees to rotate for properly oriented image (extrapolated from EXIF etc.)
-    var $animated = false;  // Animated image? (has more than 2 frames)
+    var $animated = false;  // Animated image? (has more than 1 frame)
 
     function __construct($id=null, $filepath=null, $type=null, $width=null, $height=null)
     {
diff --git a/plugins/ImageMagick/ImageMagickPlugin.php b/plugins/ImageMagick/ImageMagickPlugin.php
index 80a59b10e7..f52ca24fec 100644
--- a/plugins/ImageMagick/ImageMagickPlugin.php
+++ b/plugins/ImageMagick/ImageMagickPlugin.php
@@ -49,7 +49,16 @@ if (!defined('GNUSOCIAL')) { exit(1); }
 class ImageMagickPlugin extends Plugin
 {
     // configurable plugin options must be declared public
-    public $resize_animated = false;
+    public $resize_animated = null;
+
+    public function initialize()
+    {
+        parent::initialize();
+
+        if (is_null($this->resize_animated)) {
+            $this->resize_animated = common_config('image', 'resize_animated');
+        }
+    }
 
     /**
      * @param ImageFile $file An ImageFile object we're getting metadata for
-- 
2.39.5