getMimeType($path); if(substr_count($mimetype, '/')) { list($type, $subtype) = explode('/', $mimetype); } $iconsroot = \OC::$SERVERROOT . '/core/img/filetypes/'; 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; } } \OC\Preview::registerProvider('OC\Preview\Unknown');