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