当前位置: 首页>>代码示例>>PHP>>正文


PHP File::_updateMetaDataProperties方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Resource\File::_updateMetaDataProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP File::_updateMetaDataProperties方法的具体用法?PHP File::_updateMetaDataProperties怎么用?PHP File::_updateMetaDataProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Resource\File的用法示例。


在下文中一共展示了File::_updateMetaDataProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setFileMetadata

 /**
  * Updates the dimension (height, width) and duration metadata of the specified media file in FAL
  *
  * @param  \TYPO3\CMS\Core\Resource\File $file  FAL record
  * @return void
  */
 protected function setFileMetadata(\TYPO3\CMS\Core\Resource\File $file)
 {
     // Get file for local processing
     $localFile = $file->getForLocalProcessing(FALSE);
     // Fetch media information
     $parser = new \PHPVideoToolkit\MediaParser();
     $fileInfo = $parser->getFileInformation($localFile);
     // Collect relevant media information
     $fileMetadata = array();
     $fileMetadata['duration'] = $fileInfo['duration']->total_seconds;
     if (isset($fileInfo['video']['dimensions'])) {
         $fileMetadata['height'] = $fileInfo['video']['dimensions']['height'];
         $fileMetadata['width'] = $fileInfo['video']['dimensions']['width'];
     }
     // Update metadata of FAL record
     if (!empty($fileMetadata)) {
         $file->_updateMetaDataProperties($fileMetadata);
         $this->metaDataRepository->update($file->getUid(), $fileMetadata);
     }
 }
开发者ID:lokamaya,项目名称:html5mediaelements,代码行数:26,代码来源:OptimizeMediaCommandController.php

示例2: extractRequiredMetaData

 /**
  * Since the core desperately needs image sizes in metadata table put them there
  * This should be called after every "content" update and "record" creation
  *
  * @param File $fileObject
  */
 protected function extractRequiredMetaData(File $fileObject)
 {
     // since the core desperately needs image sizes in metadata table do this manually
     // prevent doing this for remote storages, remote storages must provide the data with extractors
     if ($fileObject->getType() == File::FILETYPE_IMAGE && $this->storage->getDriverType() === 'Local') {
         $rawFileLocation = $fileObject->getForLocalProcessing(FALSE);
         $imageInfo = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Type\\File\\ImageInfo', $rawFileLocation);
         $metaData = array('width' => $imageInfo->getWidth(), 'height' => $imageInfo->getHeight());
         $this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
         $fileObject->_updateMetaDataProperties($metaData);
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:18,代码来源:Indexer.php

示例3: extractRequiredMetaData

 /**
  * Since the core desperately needs image sizes in metadata table put them there
  * This should be called after every "content" update and "record" creation
  *
  * @param File $fileObject
  */
 protected function extractRequiredMetaData(File $fileObject)
 {
     // since the core desperately needs image sizes in metadata table do this manually
     // prevent doing this for remote storages, remote storages must provide the data with extractors
     if ($fileObject->getType() == File::FILETYPE_IMAGE && $this->storage->getDriverType() === 'Local') {
         $rawFileLocation = $fileObject->getForLocalProcessing(FALSE);
         $metaData = array();
         list($metaData['width'], $metaData['height']) = getimagesize($rawFileLocation);
         $this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
         $fileObject->_updateMetaDataProperties($metaData);
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:18,代码来源:Indexer.php


注:本文中的TYPO3\CMS\Core\Resource\File::_updateMetaDataProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。