private static function FlmngrServer::reqFilePreview in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Processes request to get file preview.
1 call to FlmngrServer::reqFilePreview()
- FlmngrServer::flmngrRequest in src/
Flmngr/ FlmngrServer/ FlmngrServer.php - Processes a request to file manager.
File
- src/
Flmngr/ FlmngrServer/ FlmngrServer.php, line 383
Class
- FlmngrServer
- File Manager server. This is a entry point for processing any of incoming Flmngr client's request. It takes "action" parameter from request and decides which request processor to use and executes it, then returns a result as…
Namespace
Drupal\n1ed\Flmngr\FlmngrServerCode
private static function reqFilePreview($config, RequestStack $request_stack) {
$filePath = $request_stack
->getCurrentRequest()->query
->get('f');
$width = $request_stack
->getCurrentRequest()->query
->get('width');
$height = $request_stack
->getCurrentRequest()->query
->get('height');
try {
$fileSystem = new FMDiskFileSystem($config);
list($mimeType, $f) = $fileSystem
->getImagePreview($filePath, $width, $height);
header('Content-Type:' . $mimeType);
fpassthru($f);
die;
} catch (MessageException $e) {
return new Response($e
->getFailMessage(), NULL);
}
}