[Pkg-owncloud-commits] [owncloud] 22/205: Send the mime icon if we can't generate a preview

David Prévot taffit at moszumanska.debian.org
Thu Jul 2 17:36:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 13617a04751b980fbb8b601829d8ff32e55274c3
Author: Olivier Paroz <github at oparoz.com>
Date:   Tue Apr 14 18:01:56 2015 +0200

    Send the mime icon if we can't generate a preview
---
 lib/private/preview.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/private/preview.php b/lib/private/preview.php
index 145b792..d8a9a3e 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -701,9 +701,12 @@ class Preview {
 			$this->generatePreview($fileId);
 		}
 
-		// We still don't have a preview, so we generate an empty object which can't be displayed
+		// We still don't have a preview, so we send back the mime icon
 		if (is_null($this->preview)) {
 			$this->preview = new \OC_Image();
+			$mimeIconWebPath = \OC_Helper::mimetypeIcon($this->mimeType);
+			$mimeIconServerPath =  str_replace(\OC::$WEBROOT, \OC::$SERVERROOT, $mimeIconWebPath);
+			$this->preview->loadFromFile($mimeIconServerPath);
 		}
 
 		return $this->preview;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list