//400 Bad Request \OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG); exit; } try { $preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files', $file); $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files_trashbin/files'); if ($view->is_dir($file)) { $mimetype = 'httpd/unix-directory'; } else { $pathInfo = pathinfo(ltrim($file, '/')); $fileName = $pathInfo['basename']; // if in root dir if ($pathInfo['dirname'] === '.') { // cut off the .d* suffix $i = strrpos($fileName, '.'); if ($i !== false) { $fileName = substr($fileName, 0, $i); } } $mimetype = \OC::$server->getMimeTypeDetector()->detectPath($fileName); } $preview->setMimetype($mimetype); $preview->setMaxX($maxX); $preview->setMaxY($maxY); $preview->setScalingUp($scalingUp); $preview->showPreview(); } catch (\Exception $e) { \OC_Response::setStatus(500); \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::DEBUG); }