本文整理汇总了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));
}
示例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('&', $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));
}
示例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();
}
示例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&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('&', $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));
}
示例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);
}