exit; } $sharedFile = \OC\Files\Filesystem::normalizePath($file); } if ($linkedItem['item_type'] === 'file') { $parent = $pathInfo['parent']; $path = $view->getPath($parent); $sharedFile = $pathInfo['name']; } $path = \OC\Files\Filesystem::normalizePath($path, false); if (substr($path, 0, 1) === '/') { $path = substr($path, 1); } if ($maxX === 0 || $maxY === 0) { \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); \OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG); exit; } $root = 'files/' . $path; try { $preview = new \OC\Preview($userId, $root); $preview->setFile($sharedFile); $preview->setMaxX($maxX); $preview->setMaxY($maxY); $preview->setScalingUp($scalingUp); $preview->setKeepAspect($keepAspect); $preview->showPreview(); } catch (\Exception $e) { \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::DEBUG); }