Use the PreviewManager where possible
This commit is contained in:
parent
1075914f8a
commit
4c4c0fa120
|
@ -20,10 +20,10 @@ OCP\Util::addScript('files', 'filelist');
|
|||
OCP\Util::addscript('files', 'keyboardshortcuts');
|
||||
|
||||
$thumbSize=1024;
|
||||
$previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'false';
|
||||
$previewSupported = \OC::$server->getPreviewManager()->isMimeSupported($_['mimetype']) ? 'true' : 'false';
|
||||
?>
|
||||
|
||||
<?php if ( \OC\Preview::isMimeSupported($_['mimetype'])): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>
|
||||
<?php if ($previewSupported === 'true'): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>
|
||||
<link rel="image_src" href="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $thumbSize, 'y' => $thumbSize, 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -29,13 +29,12 @@ if ($maxX === 0 || $maxY === 0) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
|
||||
|
||||
$info = \OC\Files\Filesystem::getFileInfo($file);
|
||||
|
||||
if (!$info instanceof OCP\Files\FileInfo || !$always && !$preview->isAvailable($info)) {
|
||||
if (!$info instanceof OCP\Files\FileInfo || !$always && !\OC::$server->getPreviewManager()->isAvailable($info)) {
|
||||
\OC_Response::setStatus(404);
|
||||
} else {
|
||||
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
|
||||
$preview->setFile($file);
|
||||
$preview->setMaxX($maxX);
|
||||
$preview->setMaxY($maxY);
|
||||
|
|
Loading…
Reference in New Issue