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(400);
    //400 Bad Request
    \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::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->show();
} catch (\Exception $e) {
    \OC_Response::setStatus(500);
    \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
}