From: Mikael Nordfeldth <mmn@hethane.se>
Date: Sat, 24 Jan 2015 10:38:10 +0000 (+0100)
Subject: No need to pre-generate thumbnails anymore
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ef0a703bdd11b53af6fd318d34c18c8a763bc49d;p=quix0rs-gnu-social.git

No need to pre-generate thumbnails anymore

Qvitter fixed their queet-expand-view! By not making thumbnails on upload
we'll save a bit of time and resources, saving the post much quicker.
---

diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php
index 47d9744344..8e59fec59c 100644
--- a/actions/apimediaupload.php
+++ b/actions/apimediaupload.php
@@ -74,17 +74,8 @@ class ApiMediaUploadAction extends ApiAuthAction
 
         // we could catch "NoUploadedMediaException" as "no media uploaded", but here we _always_ want an upload
         $upload = MediaFile::fromUpload('media', $this->scoped);
-
-        // Hack to make a thumbnail before giving back a response
-        // (the file should instead actually be attached to a notice in the file_to_post table)
-        try {
-            if ($upload->fileRecord instanceof File) {
-                $upload->fileRecord->getThumbnail();
-            }
-        } catch (Exception $e) {
-            common_debug(sprintf('A hack is buggy: MediaFile fileRecord could not getThumbnail for file id==%u',
-                                 $upload->fileRecord->id));
-        }
+        
+        // Thumbnails will be generated/cached on demand when accessed (such as with /attachment/:id/thumbnail)
 
         $this->showResponse($upload);
     }