public static function determineIcon($file) { if ($file['type'] === 'dir') { $dir = $file['directory']; $absPath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir . '/' . $file['name']); $mount = \OC\Files\Filesystem::getMountManager()->find($absPath); if (!is_null($mount)) { $sid = $mount->getStorageId(); if (!is_null($sid)) { $sid = explode(':', $sid); if ($sid[0] === 'shared') { return \OC_Helper::mimetypeIcon('dir-shared'); } if ($sid[0] !== 'local' and $sid[0] !== 'home') { return \OC_Helper::mimetypeIcon('dir-external'); } } } return \OC_Helper::mimetypeIcon('dir'); } if ($file['isPreviewAvailable']) { $pathForPreview = $file['directory'] . '/' . $file['name']; return \OC_Helper::previewIcon($pathForPreview) . '&c=' . $file['etag']; } return \OC_Helper::mimetypeIcon($file['mimetype']); }
/** * make preview_icon available as a simple function * Returns the path to the preview of the image. * @param string $path path of file * @return link to the preview * * For further information have a look at OC_Helper::previewIcon */ function preview_icon($path) { return OC_Helper::previewIcon($path); }