/** * @param Attachment $attachment * @return null|\Symfony\Component\HttpFoundation\File\File */ private function createThumbnail(Attachment $attachment) { $fileName = $attachment->getFile()->getPathname(); $fileParts = explode('/', $fileName); array_pop($fileParts); $prefix = array_pop($fileParts); try { $this->managerImpl->createThumbnail($attachment->getFile(), $attachment->getHash(), $prefix); $thumbnail = $this->attachmentService->getThumbnail($attachment->getHash()); } catch (\Exception $e) { $thumbnail = null; } return $thumbnail; }