Exemplo n.º 1
0
 /**
  * Calculates the compatibility values
  * This is duplicate code taken from ContentObjectRenderer::getImgResource()
  * Ideally we should get rid of this code in both places.
  *
  * @param ProcessedFile $processedImage
  * @return array
  */
 protected function getCompatibilityImageResourceValues(ProcessedFile $processedImage)
 {
     $hash = $processedImage->calculateChecksum();
     if (isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
         $compatibilityImageResourceValues = $GLOBALS['TSFE']->tmpl->fileCache[$hash];
     } else {
         $compatibilityImageResourceValues = array(0 => $processedImage->getProperty('width'), 1 => $processedImage->getProperty('height'), 2 => $processedImage->getExtension(), 3 => $processedImage->getPublicUrl(), 'origFile' => $processedImage->getOriginalFile()->getPublicUrl(), 'origFile_mtime' => $processedImage->getOriginalFile()->getModificationTime(), 'originalFile' => $processedImage->getOriginalFile(), 'processedFile' => $processedImage, 'fileCacheHash' => $hash);
     }
     return $compatibilityImageResourceValues;
 }
 /**
  * Updates an existing file object in the database
  *
  * @param \TYPO3\CMS\Core\Resource\ProcessedFile $processedFile
  * @return void
  */
 public function update($processedFile)
 {
     $uid = intval($processedFile->getProperty('uid'));
     if ($uid > 0) {
         // @todo: make sure that the toArray method only
         // contains fields that actually *exist* in the table
         $updateFields = $processedFile->toArray();
         $updateFields['tstamp'] = time();
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery($this->table, 'uid=' . $uid, $updateFields);
     }
 }
 /**
  * Updates an existing file object in the database
  *
  * @param ProcessedFile $processedFile
  * @return void
  */
 public function update($processedFile)
 {
     if ($processedFile->isPersisted()) {
         $uid = intval($processedFile->getProperty('uid'));
         $updateFields = $this->cleanUnavailableColumns($processedFile->toArray());
         $updateFields['tstamp'] = time();
         $this->databaseConnection->exec_UPDATEquery($this->table, 'uid=' . intval($uid), $updateFields);
     }
 }
Exemplo n.º 4
0
	/**
	 * Calculates the compatibility values
	 * This is duplicate code taken from ContentObjectRenderer::getImgResource()
	 * Ideally we should get rid of this code in both places.
	 *
	 * @param ProcessedFile $processedImage
	 * @return array
	 */
	protected function getCompatibilityImageResourceValues(ProcessedFile $processedImage) {
		$hash = $processedImage->calculateChecksum();
		if (isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
			$compatibilityImageResourceValues = $GLOBALS['TSFE']->tmpl->fileCache[$hash];
		} else {
			$compatibilityImageResourceValues = array(
				0 => $processedImage->getProperty('width'),
				1 => $processedImage->getProperty('height'),
				2 => $processedImage->getExtension(),
				3 => $processedImage->getPublicUrl(),
				'origFile' => $processedImage->getOriginalFile()->getPublicUrl(),
				'origFile_mtime' => $processedImage->getOriginalFile()->getModificationTime(),
				// This is needed by \TYPO3\CMS\Frontend\Imaging\GifBuilder,
				// in order for the setup-array to create a unique filename hash.
				'originalFile' => $processedImage->getOriginalFile(),
				'processedFile' => $processedImage,
				'fileCacheHash' => $hash
			);
		}
		return $compatibilityImageResourceValues;
	}