當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ResourceFactory::getFileObject方法代碼示例

本文整理匯總了PHP中TYPO3\CMS\Core\Resource\ResourceFactory::getFileObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP ResourceFactory::getFileObject方法的具體用法?PHP ResourceFactory::getFileObject怎麽用?PHP ResourceFactory::getFileObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TYPO3\CMS\Core\Resource\ResourceFactory的用法示例。


在下文中一共展示了ResourceFactory::getFileObject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createDomainObject

 /**
  * @param array $databaseRow
  * @return ProcessedFile
  */
 protected function createDomainObject(array $databaseRow)
 {
     $originalFile = $this->resourceFactory->getFileObject((int) $databaseRow['original']);
     $originalFile->setStorage($this->resourceFactory->getStorageObject($originalFile->getProperty('storage')));
     $taskType = $databaseRow['task_type'];
     $configuration = unserialize($databaseRow['configuration']);
     return GeneralUtility::makeInstance($this->objectType, $originalFile, $taskType, $configuration, $databaseRow);
 }
開發者ID:rickymathew,項目名稱:TYPO3.CMS,代碼行數:12,代碼來源:ProcessedFileRepository.php

示例2: convertFrom

 /**
  * Actually convert from $source to $targetType, taking into account the fully
  * built $convertedChildProperties and $configuration.
  *
  * @param string|integer $source
  * @param string $targetType
  * @param array $convertedChildProperties
  * @param \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration
  * @throws \TYPO3\CMS\Extbase\Property\Exception
  * @return \TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder
  * @api
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL)
 {
     if (!isset($source['error']) || $source['error'] === \UPLOAD_ERR_NO_FILE) {
         if (isset($source['submittedFile']['resourcePointer'])) {
             try {
                 $resourcePointer = $this->hashService->validateAndStripHmac($source['submittedFile']['resourcePointer']);
                 if (strpos($resourcePointer, 'file:') === 0) {
                     $fileUid = substr($resourcePointer, 5);
                     return $this->createFileReferenceFromFalFileObject($this->resourceFactory->getFileObject($fileUid));
                 } else {
                     return $this->createFileReferenceFromFalFileReferenceObject($this->resourceFactory->getFileReferenceObject($resourcePointer), $resourcePointer);
                 }
             } catch (\InvalidArgumentException $e) {
                 // Nothing to do. No file is uploaded and resource pointer is invalid. Discard!
             }
         }
         return NULL;
     }
     if ($source['error'] !== \UPLOAD_ERR_OK) {
         switch ($source['error']) {
             case \UPLOAD_ERR_INI_SIZE:
             case \UPLOAD_ERR_FORM_SIZE:
             case \UPLOAD_ERR_PARTIAL:
                 return new Error(Files::getUploadErrorMessage($source['error']), 1264440823);
             default:
                 return new Error('An error occurred while uploading. Please try again or contact the administrator if the problem remains', 1340193849);
         }
     }
     if (isset($this->convertedResources[$source['tmp_name']])) {
         return $this->convertedResources[$source['tmp_name']];
     }
     try {
         $resource = $this->importUploadedResource($source, $configuration);
     } catch (\Exception $e) {
         return new Error($e->getMessage(), $e->getCode());
     }
     $this->convertedResources[$source['tmp_name']] = $resource;
     return $resource;
 }
開發者ID:philippjbauer,項目名稱:h5upldr,代碼行數:51,代碼來源:UploadedFileReferenceConverter.php

示例3: getInfoByUid

 /**
  * @param integer $uid
  * @return array
  */
 public function getInfoByUid($uid)
 {
     $file = $this->resourceFactory->getFileObject($uid);
     return ResourceUtility::getFileArray($file);
 }
開發者ID:pkerling,項目名稱:vhs,代碼行數:9,代碼來源:AbstractImageInfoViewHelper.php


注:本文中的TYPO3\CMS\Core\Resource\ResourceFactory::getFileObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。