/** * @param int $id * @param string $action * * @return \Symfony\Component\HttpFoundation\Response * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id, $action = '') { set_time_limit(20); $picture = $this->pictureRepository->getFileById($id); $action = $action === 'thumb' ? 'thumb' : ''; /** @var Core\Picture $image */ $image = $this->get('core.image'); $image->setEnableCache($this->config->getSettings(Schema::MODULE_NAME)['cache_images'] == 1)->setCachePrefix('gallery_' . $action)->setCacheDir($this->appPath->getUploadsDir() . 'gallery/cache/')->setMaxWidth($this->settings[$action . 'width'])->setMaxHeight($this->settings[$action . 'height'])->setFile($this->appPath->getUploadsDir() . 'gallery/' . $picture)->setPreferHeight($action === 'thumb'); if ($image->process()) { return $image->sendResponse(); } throw new Core\Controller\Exception\ResultNotExistsException(); }