Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PreviewImage.php
Go to the documentation of this file.
1 <?php
8 
11 
13 {
19  public function execute()
20  {
21  $file = $this->getRequest()->getParam('file');
23  $helper = $this->_objectManager->get(\Magento\Theme\Helper\Storage::class);
24  try {
25  return $this->_fileFactory->create(
26  $file,
27  ['type' => 'filename', 'value' => $helper->getThumbnailPath($file)],
28  DirectoryList::MEDIA
29  );
30  } catch (\Exception $e) {
31  $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
32  $this->_redirect('core/index/notFound');
33  }
34  }
35 }
$helper
Definition: iframe.phtml:13