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


PHP FileInterface::getOriginalFile方法代码示例

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


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

示例1: render

 /**
  * Render for given File(Reference) html output
  *
  * @param FileInterface $file
  * @param int|string $width TYPO3 known format; examples: 220, 200m or 200c
  * @param int|string $height TYPO3 known format; examples: 220, 200m or 200c
  * @param array $options
  * @param bool $usedPathsRelativeToCurrentScript See $file->getPublicUrl()
  * @return string
  */
 public function render(FileInterface $file, $width, $height, array $options = null, $usedPathsRelativeToCurrentScript = false)
 {
     if ($file instanceof FileReference) {
         $autoplay = $file->getProperty('autoplay');
         if ($autoplay !== null) {
             $options['autoplay'] = $autoplay;
         }
     }
     $urlParams = array();
     if (!empty($options['autoplay'])) {
         $urlParams[] = 'autoplay=1';
     }
     if (!empty($options['loop'])) {
         $urlParams[] = 'loop=1';
     }
     $urlParams[] = 'title=' . (int) (!empty($options['showinfo']));
     $urlParams[] = 'byline=' . (int) (!empty($options['showinfo']));
     $urlParams[] = 'portrait=0';
     if ($file instanceof FileReference) {
         $orgFile = $file->getOriginalFile();
     } else {
         $orgFile = $file;
     }
     $videoId = $this->getOnlineMediaHelper($file)->getOnlineMediaId($orgFile);
     $src = sprintf('//player.vimeo.com/video/%s?%s', $videoId, implode('&', $urlParams));
     $attributes = array('allowfullscreen');
     if ((int) $width > 0) {
         $attributes[] = 'width="' . (int) $width . '"';
     }
     if ((int) $height > 0) {
         $attributes[] = 'height="' . (int) $height . '"';
     }
     if (is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->config['config']['doctype'] !== 'html5') {
         $attributes[] = 'frameborder="0"';
     }
     foreach (array('class', 'dir', 'id', 'lang', 'style', 'title', 'accesskey', 'tabindex', 'onclick') as $key) {
         if (!empty($options[$key])) {
             $attributes[] = $key . '="' . htmlspecialchars($options[$key]) . '"';
         }
     }
     return sprintf('<iframe src="%s"%s></iframe>', $src, empty($attributes) ? '' : ' ' . implode(' ', $attributes));
 }
开发者ID:tantegerda1,项目名称:TYPO3.ContentRenderingCore,代码行数:52,代码来源:VimeoRenderer.php

示例2: render

 /**
  * Render for given File(Reference) html output
  *
  * @param FileInterface $file
  * @param int|string $width TYPO3 known format; examples: 220, 200m or 200c
  * @param int|string $height TYPO3 known format; examples: 220, 200m or 200c
  * @param array $options
  * @param bool $usedPathsRelativeToCurrentScript See $file->getPublicUrl()
  * @return string
  */
 public function render(FileInterface $file, $width, $height, array $options = null, $usedPathsRelativeToCurrentScript = false)
 {
     if ($file instanceof FileReference) {
         $autoplay = $file->getProperty('autoplay');
         if ($autoplay !== null) {
             $options['autoplay'] = $autoplay;
         }
     }
     $urlParams = array();
     if (!empty($options['autoplay'])) {
         $urlParams[] = 'auto_play=1';
     }
     if ($file instanceof FileReference) {
         $orgFile = $file->getOriginalFile();
     } else {
         $orgFile = $file;
     }
     $soundCloudId = $this->getOnlineMediaHelper($file)->getOnlineMediaId($orgFile);
     $src = sprintf('//w.soundcloud.com/player/?url=%s?%s', urlencode('https://api.soundcloud.com/tracks/' . $soundCloudId), implode('&amp;', $urlParams));
     foreach (['class', 'dir', 'id', 'lang', 'style', 'title', 'accesskey', 'tabindex', 'onclick'] as $key) {
         if (!empty($options[$key])) {
             $attributes[] = $key . '="' . htmlspecialchars($options[$key]) . '"';
         }
     }
     return sprintf('<iframe src="%s"%s></iframe>', $src, empty($attributes) ? '' : ' ' . implode(' ', $attributes));
 }
开发者ID:martinpfister,项目名称:manuel,代码行数:36,代码来源:SoundCloudRenderer.php

示例3: render

 /**
  * @param FileInterface $file
  * @param int|string $width TYPO3 known format; examples: 220, 200m or 200c
  * @param int|string $height TYPO3 known format; examples: 220, 200m or 200c
  * @param array $options
  * @param bool $usedPathsRelativeToCurrentScript See $file->getPublicUrl()
  * @return string
  */
 public function render(FileInterface $file, $width, $height, array $options = array(), $usedPathsRelativeToCurrentScript = false)
 {
     $data = $srcset = $sizes = [];
     if ($file instanceof FileReference) {
         $originalFile = $file->getOriginalFile();
     } else {
         $originalFile = $file;
     }
     try {
         $defaultProcessConfiguration = [];
         $defaultProcessConfiguration['width'] = (int) $width;
         $defaultProcessConfiguration['crop'] = $file->getProperty('crop');
     } catch (\InvalidArgumentException $e) {
         $defaultProcessConfiguration['crop'] = '';
     }
     foreach ($this->settings['sourceCollection'] as $configuration) {
         try {
             if (!is_array($configuration)) {
                 throw new \RuntimeException();
             }
             if (isset($configuration['sizes'])) {
                 $sizes[] = trim($configuration['sizes'], ' ,');
             }
             if ((int) $configuration['width'] > (int) $width) {
                 throw new \RuntimeException();
             }
             $localProcessingConfiguration = $defaultProcessConfiguration;
             $localProcessingConfiguration['width'] = $configuration['width'];
             $processedFile = $originalFile->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $localProcessingConfiguration);
             $url = $this->absRefPrefix . $processedFile->getPublicUrl();
             $data['data-' . $configuration['dataKey']] = $url;
             $srcset[] = $url . rtrim(' ' . $configuration['srcset'] ?: '');
         } catch (\Exception $ignoredException) {
             continue;
         }
     }
     $src = $originalFile->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $defaultProcessConfiguration)->getPublicUrl();
     $this->tagBuilder->reset();
     $this->tagBuilder->setTagName('img');
     $this->tagBuilder->addAttribute('src', $src);
     $this->tagBuilder->addAttribute('alt', $file->getProperty('alternative'));
     $this->tagBuilder->addAttribute('title', $file->getProperty('title'));
     switch ($this->settings['layoutKey']) {
         case 'srcset':
             if (!empty($srcset)) {
                 $this->tagBuilder->addAttribute('srcset', implode(', ', $srcset));
             }
             $this->tagBuilder->addAttribute('sizes', implode(', ', $sizes));
             break;
         case 'data':
             if (!empty($data)) {
                 foreach ($data as $key => $value) {
                     $this->tagBuilder->addAttribute($key, $value);
                 }
             }
             break;
         default:
             $this->tagBuilder->addAttributes(['width' => (int) $width, 'height' => (int) $height]);
             break;
     }
     return $this->tagBuilder->render();
 }
开发者ID:pfeilda,项目名称:fluid-styled-responsive-images,代码行数:70,代码来源:ImageRenderer.php

示例4: render

 /**
  * Render for given File(Reference) html output
  *
  * @param FileInterface $file
  * @param int|string $width TYPO3 known format; examples: 220, 200m or 200c
  * @param int|string $height TYPO3 known format; examples: 220, 200m or 200c
  * @param array $options
  * @param bool $usedPathsRelativeToCurrentScript See $file->getPublicUrl()
  * @return string
  */
 public function render(FileInterface $file, $width, $height, array $options = null, $usedPathsRelativeToCurrentScript = false)
 {
     if ($file instanceof FileReference) {
         $autoplay = $file->getProperty('autoplay');
         if ($autoplay !== null) {
             $options['autoplay'] = $autoplay;
         }
     }
     $urlParams = array('autohide=1');
     if (!isset($options['controls']) || !empty($options['controls'])) {
         $urlParams[] = 'controls=2';
     }
     if (!empty($options['autoplay'])) {
         $urlParams[] = 'autoplay=1';
     }
     if (!empty($options['loop'])) {
         $urlParams[] = 'loop=1';
     }
     if (!isset($options['enablejsapi']) || !empty($options['enablejsapi'])) {
         $urlParams[] = 'enablejsapi=1&amp;origin=' . GeneralUtility::getIndpEnv('HTTP_HOST');
     }
     $urlParams[] = 'showinfo=' . (int) (!empty($options['showinfo']));
     if ($file instanceof FileReference) {
         $orgFile = $file->getOriginalFile();
     } else {
         $orgFile = $file;
     }
     $videoId = $this->getOnlineMediaHelper($file)->getOnlineMediaId($orgFile);
     $src = sprintf('//www.youtube%s.com/embed/%s?%s', !empty($options['no-cookie']) ? '-nocookie' : '', $videoId, implode('&amp;', $urlParams));
     $attributes = ['allowfullscreen'];
     if ((int) $width > 0) {
         $attributes[] = 'width="' . (int) $width . '"';
     }
     if ((int) $height > 0) {
         $attributes[] = 'height="' . (int) $height . '"';
     }
     if (is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->config['config']['doctype'] !== 'html5') {
         $attributes[] = 'frameborder="0"';
     }
     foreach (['class', 'dir', 'id', 'lang', 'style', 'title', 'accesskey', 'tabindex', 'onclick', 'poster', 'preload'] as $key) {
         if (!empty($options[$key])) {
             $attributes[] = $key . '="' . htmlspecialchars($options[$key]) . '"';
         }
     }
     return sprintf('<iframe src="%s"%s></iframe>', $src, empty($attributes) ? '' : ' ' . implode(' ', $attributes));
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:56,代码来源:YouTubeRenderer.php

示例5: render

 /**
  * @param FileInterface $file
  * @param int|string $width TYPO3 known format; examples: 220, 200m or 200c
  * @param int|string $height TYPO3 known format; examples: 220, 200m or 200c
  * @param array $options
  * @param bool $usedPathsRelativeToCurrentScript See $file->getPublicUrl()
  * @return string
  */
 public function render(FileInterface $file, $width, $height, array $options = [], $usedPathsRelativeToCurrentScript = false)
 {
     $this->reset();
     $this->defaultWidth = $width;
     $this->defaultHeight = $height;
     if (is_callable([$file, 'getOriginalFile'])) {
         /** @var FileReference $file */
         $originalFile = $file->getOriginalFile();
     } else {
         $originalFile = $file;
     }
     try {
         $defaultProcessConfiguration = [];
         if ($this->getConfiguration()->getExtensionConfiguration()['enableSmallDefaultImage']) {
             $defaultProcessConfiguration['width'] = '360m';
         }
         $defaultProcessConfiguration['crop'] = $file->getProperty('crop');
     } catch (\InvalidArgumentException $e) {
         $defaultProcessConfiguration['crop'] = '';
     }
     $this->processSourceCollection($originalFile, $defaultProcessConfiguration);
     $src = $originalFile->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $defaultProcessConfiguration)->getPublicUrl();
     return $this->buildImageTag($src, $file, $options);
 }
开发者ID:alexanderschnitzler,项目名称:fluid-styled-responsive-images,代码行数:32,代码来源:ImageRenderer.php


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