/** * @param ThumbnailedElement $element * @param $thumbnailType * @param File $file */ public function setThumbnail(ThumbnailedElement $element, $thumbnailType, File $file = null) { $filename = null; if (!is_null($file)) { $this->validateFileMimeType($file); $filename = $this->generateThumbnail($thumbnailType, $file); } $logoFile = $this->rootPath . '/config/' . $thumbnailType . '/' . $element->getRootIdentifier(); $custom_path = $this->rootPath . '/www/custom/' . $thumbnailType . '/' . $element->getRootIdentifier(); foreach ([$logoFile, $custom_path] as $target) { $this->copyFile($target, $filename); } $element->updateThumbnail($thumbnailType, $file); }
public function setThumbnail(ThumbnailedElement $element, $thumbnailType, File $file = null) { $filename = null; if ($thumbnailType !== ThumbnailManager::TYPE_PDF) { throw new \InvalidArgumentException('Unsupported thumbnail type.'); } if (!is_null($file)) { $this->validateFileMimeType($file); $filename = $this->generateThumbnail($file); } $logoFile = $this->rootPath . '/config/minilogos/' . $thumbnailType . '_' . $element->getRootIdentifier() . '.jpg'; $custom_path = $this->rootPath . '/www/custom/minilogos/' . $thumbnailType . '_' . $element->getRootIdentifier() . '.jpg'; foreach ([$logoFile, $custom_path] as $target) { $this->copyFile($target, $filename); } $element->updateThumbnail($thumbnailType, $file); }