]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/File.php
Improved animated image thumbnail freedom of choice
[quix0rs-gnu-social.git] / classes / File.php
index 58b1b0ed8943f6ac245bfa257c77dabfcda75e6e..ce2f9401618286bcfd9485f8f3682add5c8df0f2 100644 (file)
@@ -382,12 +382,16 @@ class File extends Managed_DataObject
      *
      * @return File_thumbnail
      */
-    public function getThumbnail($width=null, $height=null, $crop=false)
+    public function getThumbnail($width=null, $height=null, $crop=false, $force_still=true)
     {
         // Get some more information about this file through our ImageFile class
         $image = ImageFile::fromFileObject($this);
-        if ($image->animated && is_null(common_config('thumbnail', 'animated'))) {
-            throw new UseFileAsThumbnailException($this->id);
+        if ($image->animated && !common_config('thumbnail', 'animated')) {
+            // null  means "always use file as thumbnail"
+            // false means you get choice between frozen frame or original when calling getThumbnail
+            if (is_null(common_config('thumbnail', 'animated')) || !$force_still) {
+                throw new UseFileAsThumbnailException($this->id);
+            }
         }
 
         if ($width === null) {