/** * @return string */ public function getFileName() { $parameters = array(); if ($this->itemListData->count() > 0) { $item = $this->itemListData->getFirstRow()->getCell('image')->getValue(); /** @var Tx_Yag_Domain_Model_Item $item */ $parameters = array('album' => $item->getAlbum()->getName(), 'gallery' => $item->getAlbum()->getGallery()->getName()); } $formattedFileName = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($parameters, $this->fileNameFormat); if (substr(strtolower($formattedFileName), -4, 4) != '.zip') { $formattedFileName .= '.zip'; } $formattedFileName = $this->fileSystemDiv->cleanFileName($formattedFileName); return $formattedFileName; }
/** * @param $imageName * @return string */ protected function getMeaningfulTempFilePrefix($imageName) { if ($this->processorConfiguration->getMeaningfulTempFilePrefix() > 0 && $imageName != '') { $cleanFileName = $this->fileSystemDiv->cleanFileName($imageName); if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) { $t3libCsInstance = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter'); /** @var $t3libCsInstance \TYPO3\CMS\Core\Charset\CharsetConverter */ $meaningfulPrefix = $t3libCsInstance->substr('utf-8', $cleanFileName, 0, $this->processorConfiguration->getMeaningfulTempFilePrefix()); } else { $meaningfulPrefix = substr($cleanFileName, 0, $this->processorConfiguration->getMeaningfulTempFilePrefix()); } $meaningfulPrefix .= '_'; return $meaningfulPrefix; } return ''; }
/** * Moves a file from given filepath to directory for original images for album * * If an item is given, UID of item is used as filename for item in original items directory * * @param string $filePath Full qualified filepath of file to move * @param Tx_Yag_Domain_Model_Item $item Item that should hold file (not modified, make sure to set sourceuri manually! * @return string * @throws Exception */ protected function moveFileToOrigsDirectory($filePath, Tx_Yag_Domain_Model_Item $item = null) { // Create path to move file to $origsFilePath = $this->fileManager->getOrigFileDirectoryPathForAlbum($this->album); $fileSuffix = pathinfo($filePath, PATHINFO_EXTENSION); if ($item !== null) { if ($item->getOriginalFilename()) { $origsFilePath .= $item->getUid() . '_' . $this->fileSystemDiv->cleanFileName($item->getOriginalFilename()); } else { $origsFilePath .= $item->getUid() . '.' . $fileSuffix; // if we get an item, we use UID of item as a part of the filename } } else { $origsFilePath .= Tx_Yag_Domain_FileSystem_Div::getFilenameFromFilePath($filePath); // if we do not get one, we use filename of given filepart } if (!rename($filePath, $origsFilePath)) { throw new Exception('Could not move file ' . $filePath . ' to ' . $origsFilePath, 1294176900); } // Set appropriate file mask $this->setFileMask($origsFilePath); return $origsFilePath; }