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');
|
OCP\Util::addscript('files', 'keyboardshortcuts');
|
||||||
|
|
||||||
$thumbSize=1024;
|
$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']))); ?>" />
|
<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; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,12 @@ if ($maxX === 0 || $maxY === 0) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
|
|
||||||
|
|
||||||
$info = \OC\Files\Filesystem::getFileInfo($file);
|
$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);
|
\OC_Response::setStatus(404);
|
||||||
} else {
|
} else {
|
||||||
|
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
|
||||||
$preview->setFile($file);
|
$preview->setFile($file);
|
||||||
$preview->setMaxX($maxX);
|
$preview->setMaxX($maxX);
|
||||||
$preview->setMaxY($maxY);
|
$preview->setMaxY($maxY);
|
||||||
|
|
Loading…
Reference in New Issue