]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix orientation before caching preview
authorGeorg Ehrke <developer@georgehrke.com>
Wed, 10 Jul 2013 11:38:42 +0000 (13:38 +0200)
committerGeorg Ehrke <developer@georgehrke.com>
Wed, 10 Jul 2013 11:38:42 +0000 (13:38 +0200)
lib/preview.php

index f12107c9f579e977de5419b914dbdac21a2ff42e..6173fc8aa6b83a45e5dea78e732ba76e1c922541 100755 (executable)
@@ -332,7 +332,7 @@ class Preview {
 
                                $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview);
 
-                               if(!$preview) {
+                               if(!($preview instanceof \OC_Image)) {
                                        continue;
                                }
 
@@ -346,6 +346,8 @@ class Preview {
                                if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false) {
                                        $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/');
                                }
+
+                               $preview->fixOrientation();
                                $this->userview->file_put_contents($cachepath, $preview->data());
 
                                break;
@@ -382,8 +384,6 @@ class Preview {
         * @return image
        */
        public function resizeAndCrop() {
-               $this->preview->fixOrientation();
-
                $image = $this->preview;
                $x = $this->maxX;
                $y = $this->maxY;