summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/helper.php33
-rw-r--r--lib/preview/unknown.php22
2 files changed, 35 insertions, 20 deletions
diff --git a/lib/helper.php b/lib/helper.php
index b74e4c4512e..6552bcce703 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -188,7 +188,38 @@ class OC_Helper {
* Returns the path to the image of this file type.
*/
public static function mimetypeIcon($mimetype) {
- $alias = array('application/xml' => 'code/xml');
+ $alias = array(
+ 'application/xml' => 'code/xml',
+ 'application/msword' => 'x-office/document',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document',
+ 'application/vnd.ms-word.document.macroEnabled.12' => 'x-office/document',
+ 'application/vnd.ms-word.template.macroEnabled.12' => 'x-office/document',
+ 'application/vnd.oasis.opendocument.text' => 'x-office/document',
+ 'application/vnd.oasis.opendocument.text-template' => 'x-office/document',
+ 'application/vnd.oasis.opendocument.text-web' => 'x-office/document',
+ 'application/vnd.oasis.opendocument.text-master' => 'x-office/document',
+ 'application/vnd.ms-powerpoint' => 'x-office/presentation',
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation',
+ 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'x-office/presentation',
+ 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'x-office/presentation',
+ 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => 'x-office/presentation',
+ 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => 'x-office/presentation',
+ 'application/vnd.ms-powerpoint.template.macroEnabled.12' => 'x-office/presentation',
+ 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation',
+ 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation',
+ 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation',
+ 'application/vnd.ms-excel' => 'x-office/spreadsheet',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'x-office/spreadsheet',
+ 'application/vnd.ms-excel.sheet.macroEnabled.12' => 'x-office/spreadsheet',
+ 'application/vnd.ms-excel.template.macroEnabled.12' => 'x-office/spreadsheet',
+ 'application/vnd.ms-excel.addin.macroEnabled.12' => 'x-office/spreadsheet',
+ 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet',
+ 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet',
+ 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet',
+ );
+
if (isset($alias[$mimetype])) {
$mimetype = $alias[$mimetype];
}
diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php
index ba13ca35d66..9e6cd68d401 100644
--- a/lib/preview/unknown.php
+++ b/lib/preview/unknown.php
@@ -16,27 +16,11 @@ class Unknown extends Provider {
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$mimetype = $fileview->getMimeType($path);
- if(substr_count($mimetype, '/')) {
- list($type, $subtype) = explode('/', $mimetype);
- }
- $iconsRoot = \OC::$SERVERROOT . '/core/img/filetypes/';
+ $path = \OC_Helper::mimetypeIcon($mimetype);
+ $path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT));
- if(isset($type)){
- $icons = array($mimetype, $type, 'text');
- }else{
- $icons = array($mimetype, 'text');
- }
- foreach($icons as $icon) {
- $icon = str_replace('/', '-', $icon);
-
- $iconPath = $iconsRoot . $icon . '.png';
-
- if(file_exists($iconPath)) {
- return new \OC_Image($iconPath);
- }
- }
- return false;
+ return new \OC_Image($path);
}
}