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


PHP File::exists方法代码示例

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


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

示例1: create

 /**
  * Render a thumbnail of a media
  *
  * @throws MissingTcaConfigurationException
  * @return string
  */
 public function create()
 {
     if (empty($this->file)) {
         throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144);
     }
     // Default class name
     $className = 'Fab\\Media\\Thumbnail\\FallBackThumbnailProcessor';
     if (File::FILETYPE_IMAGE == $this->file->getType()) {
         $className = 'Fab\\Media\\Thumbnail\\ImageThumbnailProcessor';
     } elseif (File::FILETYPE_AUDIO == $this->file->getType()) {
         $className = 'Fab\\Media\\Thumbnail\\AudioThumbnailProcessor';
     } elseif (File::FILETYPE_VIDEO == $this->file->getType()) {
         $className = 'Fab\\Media\\Thumbnail\\VideoThumbnailProcessor';
     } elseif (File::FILETYPE_APPLICATION == $this->file->getType() || File::FILETYPE_TEXT == $this->file->getType()) {
         $className = 'Fab\\Media\\Thumbnail\\ApplicationThumbnailProcessor';
     }
     /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */
     $processorInstance = GeneralUtility::makeInstance($className);
     $thumbnail = '';
     if ($this->file->exists()) {
         $thumbnail = $processorInstance->setThumbnailService($this)->create();
     } else {
         $logger = Logger::getInstance($this);
         $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier()));
     }
     return $thumbnail;
 }
开发者ID:visol,项目名称:media,代码行数:33,代码来源:ThumbnailService.php

示例2: downloadAction

 /**
  * Force download of the file.
  *
  * @param File $file
  * @param bool $forceDownload
  * @return bool|string
  */
 public function downloadAction(File $file, $forceDownload = FALSE)
 {
     if ($file->exists() && $file->getStorage()->isWithinFileMountBoundaries($file->getParentFolder())) {
         // Emit signal before downloading the file.
         $this->emitBeforeDownloadSignal($file);
         // Read the file and dump it with the flag "forceDownload" set to TRUE or FALSE.
         $file->getStorage()->dumpFileContents($file, $forceDownload);
         $result = TRUE;
     } else {
         $result = 'Access denied!';
     }
     return $result;
 }
开发者ID:visol,项目名称:media,代码行数:20,代码来源:AssetController.php


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