/** * Get the item file resolution object * * @param Tx_Yag_Domain_Model_Item $item * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration * @return Tx_Yag_Domain_Model_ResolutionFileCache */ public function getResolutionByItem(Tx_Yag_Domain_Model_Item $item, Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration) { $query = $this->createQuery(); $constraints = array(); $constraints[] = $query->equals('item', $item->getUid()); $constraints[] = $query->equals('paramhash', $resolutionConfiguration->getParameterHash()); $result = $query->matching($query->logicalAnd($constraints))->execute(); $object = NULL; if ($result !== NULL && !is_array($result) && $result->current() !== FALSE) { $object = $result->current(); $this->identityMap->registerObject($object, $object->getUid()); } return $object; }
/** * Get the item file resolution object * * @param Tx_Yag_Domain_Model_Item $item * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration * @return Tx_Yag_Domain_Model_ResolutionFileCache */ public function getResolutionByItem(Tx_Yag_Domain_Model_Item $item, Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration) { $query = $this->createQuery(); $constraints = array(); $constraints[] = $query->equals('item', $item->getUid()); $constraints[] = $query->equals('paramhash', $resolutionConfiguration->getParameterHash()); $result = $query->matching($query->logicalAnd($constraints))->execute(); $object = null; if ($result !== null && !is_array($result) && $result->current() !== false) { $object = $result->current(); $session = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Session'); $session->registerObject($object, $object->getUid()); } return $object; }
/** * (non-PHPdoc) * @see Classes/Domain/ImageProcessing/Tx_Yag_Domain_ImageProcessing_ProcessorInterface::generateResolution() */ public function generateResolution(Tx_Yag_Domain_Model_Item $origFile, Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration) { $resolutionFile = new Tx_Yag_Domain_Model_ResolutionFileCache($origFile, '', 0, 0, $resolutionConfiguration->getParameterHash()); $this->processFile($resolutionConfiguration, $origFile, $resolutionFile); $this->resolutionFileCacheRepository->add($resolutionFile); return $resolutionFile; }
/** * Retrieve a resolution file from local cache * * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration * @param Tx_Yag_Domain_Model_Item $item * @return Tx_Yag_Domain_Model_ResolutionFileCache|null */ protected function getResolutionFileFromLocalCache(Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfiguration, Tx_Yag_Domain_Model_Item $item) { $objectIdentifier = md5($resolutionConfiguration->getParameterHash() . $item->getSourceuri()); if (array_key_exists($objectIdentifier, $this->localResolutionFileCache)) { return $this->localResolutionFileCache[$objectIdentifier]; } return NULL; }