/** * */ public function generate($deferredAllowed = false) { if (!$this->path) { // if no correct thumbnail config is given use the original image as thumbnail if (!$this->config) { $fsPath = $this->asset->getFileSystemPath(); $this->path = str_replace(PIMCORE_DOCUMENT_ROOT, "", $fsPath); } else { try { $deferred = $deferredAllowed && $this->deferred ? true : false; $this->path = Thumbnail\Processor::process($this->asset, $this->config, null, $deferred); } catch (\Exception $e) { $this->path = '/pimcore/static/img/filetype-not-supported.png'; \Logger::error("Couldn't create thumbnail of image " . $this->asset->getFullPath()); \Logger::error($e); } } } }
/** * @param bool $deferredAllowed */ public function generate($deferredAllowed = true) { $errorImage = PIMCORE_PATH . '/static6/img/filetype-not-supported.png'; $deferred = false; $generated = false; if (!$this->asset) { $this->filesystemPath = $errorImage; } elseif (!$this->filesystemPath) { // if no correct thumbnail config is given use the original image as thumbnail if (!$this->config) { $fsPath = $this->asset->getFileSystemPath(); $this->filesystemPath = str_replace(PIMCORE_DOCUMENT_ROOT, "", $fsPath); } else { try { $deferred = $deferredAllowed && $this->deferred ? true : false; $this->filesystemPath = Thumbnail\Processor::process($this->asset, $this->config, null, $deferred, true, $generated); } catch (\Exception $e) { $this->filesystemPath = $errorImage; \Logger::error("Couldn't create thumbnail of image " . $this->asset->getRealFullPath()); \Logger::error($e); } } } \Pimcore::getEventManager()->trigger("asset.image.thumbnail", $this, ["deferred" => $deferred, "generated" => $generated]); }