/** * Wrapper for cObj->getImageResource in FE and BE * * @param Tx_Yag_Domain_Model_Item $origFile The original image * @param string $sourcePathAndFileName Must be used to access the file, as it may be overwritten if the original file was not found * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration * @return TYPO3\CMS\Core\Resource\ProcessedFile */ protected function getImageResource(Tx_Yag_Domain_Model_Item $origFile, $sourcePathAndFileName, Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration) { $typoScriptSettings = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertPlainArrayToTypoScriptArray($resolutionConfiguration->getSettings()); $contentObject = $this->configurationManager->getContentObject(); /** @var $contentObject \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */ if ($resolutionConfiguration->getMode() == 'GIFBUILDER') { $gifBuilderData = ['yagImage' => $sourcePathAndFileName, 'yagImageTitle' => $origFile->getTitle(), 'yagImageHref' => $origFile->getHref(), 'yagImageUid' => $origFile->getUid(), 'yagAlbumUid' => $origFile->getAlbum()->getUid(), 'yagAlbumTitle' => $origFile->getAlbum()->getName(), 'yagGalleryUid' => $origFile->getAlbum()->getGallery()->getUid(), 'yagGalleryTitle' => $origFile->getAlbum()->getGallery()->getName()]; $contentObject->start($gifBuilderData); $imageResource = $contentObject->getImgResource('GIFBUILDER', $typoScriptSettings); } else { $fileObject = $this->getResourceFactory()->retrieveFileOrFolderObject($sourcePathAndFileName); $imageResource = $contentObject->getImgResource($fileObject, $typoScriptSettings); } // $this->typo3CleanUp($imageResource); return $imageResource['processedFile']; }
protected function buildItemObjectInfo(PathInfo $pathInfo, \Tx_Yag_Domain_Model_Item $item) { return array('size' => $item->getFilesize(), 'atime' => $item->getTstamp()->getTimestamp(), 'mtime' => $item->getTstamp()->getTimestamp(), 'ctime' => $item->getCrdate()->getTimestamp(), 'mimetype' => 'image/jpeg', 'yagItem' => $item, 'name' => $item->getOriginalFilename(), 'identifier' => \Tx_Yag_Domain_FileSystem_Div::concatenatePaths(array($pathInfo->getAlbumPath(), $item->getTitle() . ' |' . $item->getUid())), 'storage' => $this->storage->getUid(), 'description' => $item->getDescription(), 'title' => $item->getTitle(), 'height' => $item->getHeight(), 'width' => $item->getWidth(), 'sourceUri' => $item->getSourceuri()); }
/** * Wrapper for cObj->getImageResource in FE and BE * * @param Tx_Yag_Domain_Model_Item $origFile The original image * @param string $sourcePathAndFileName Must be used to access the file, as it may be overwritten if the original file was not found * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration * @return array $imageData */ protected function getImageResource(Tx_Yag_Domain_Model_Item $origFile, $sourcePathAndFileName, Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration) { $typoScriptSettings = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertPlainArrayToTypoScriptArray($resolutionConfiguration->getSettings()); $contentObject = $this->configurationManager->getContentObject(); /** @var $contentObject tslib_cObj */ if ($resolutionConfiguration->getMode() == 'GIFBUILDER') { $gifBuilderData = array('yagImage' => $sourcePathAndFileName, 'yagImageTitle' => $origFile->getTitle(), 'yagImageUid' => $origFile->getUid(), 'yagAlbumUid' => $origFile->getAlbum()->getUid(), 'yagAlbumTitle' => $origFile->getAlbum()->getName(), 'yagGalleryUid' => $origFile->getAlbum()->getGallery()->getUid(), 'yagGalleryTitle' => $origFile->getAlbum()->getGallery()->getName()); $contentObject->start($gifBuilderData); $imageResource = $contentObject->getImgResource('GIFBUILDER', $typoScriptSettings); } else { $imageResource = $contentObject->getImgResource($sourcePathAndFileName, $typoScriptSettings); } $this->typo3CleanUp($imageResource, $sourcePathAndFileName); return $imageResource; }