Project

General

Profile

Actions

Bug #85392

closed

Fluid ImageViewHelper cannot render ProcessedFile

Added by Leonie Philine almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2018-06-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

You cannot render a ProcessedFile via <f:image />

It neither works via:

<f:image image="{processedFile}" />

nor via

<f:image src="{processedFile.publicUrl}" />

Only viable workaround is:
<f:image src="{processedFile.publicUrl}" />

- Why would I want to do that at all, when ImageViewHelper creates ProcessedFiles itself?

--> Because I want to render a video list - using the online media helpers to create a video preview image, which should then be rendered as plain image:

    /** (Video domain model)
     * @return null|ProcessedFile
     */
    public function getPreviewImage(): ?ProcessedFile
    {
        if (!$this->videoFile
            || !$this->videoFile->getOriginalResource()
            || !$this->videoFile->getOriginalResource()->getOriginalFile()
        ) {
            return null;
        }

        $previewImageFile = $this->videoFile->getOriginalResource()->getOriginalFile()->process(
            ProcessedFile::CONTEXT_IMAGEPREVIEW,
            [
                'width' => 576,
                'height' => 324,
            ]
        );

        return $previewImageFile;
    }

`video` is a Video domain model.
`video.previewImage` is created via the getter above.
`video.videoFile` is a fileReference to a Vimeo online resource.

<f:for each="{container.videos}" as="video">
    <li class="video-list__video-item">
        <img src="{video.previewImage.publicUrl}" alt="{video.videoFile.title}" title="{video.videoFile.title}" />
        <span class="video-list__video-item__title">{video.videoFile.title}</span>
     </li>
</f:for>

It should be possible to use <f:image /> with {video.previewImage} as its input - that way, further processing (crop scale mask) would be possible.

Actions #1

Updated by Leonie Philine almost 6 years ago

Just for completeness - here the TCA for the Video model's video_files field:

        'video_file' => [
            'label' => 'LLL:EXT:ext_name/Resources/Private/Language/locallang_db.xlf:tx_extname_domain_model_video.video_file',
            'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'video_file',
                ['maxitems' => 1],
                'vimeo,youtube,ogg,ogv,webm,mp4,mpeg,m4v'
            ),
        ],

The issue occured using a Vimeo FileReference. I expect the same for YouTube FileReferences. I have not yet tried local video files (that really depends on if imagemagick can `convert` a video file into a preview image. @see \TYPO3\CMS\Core\Resource\Processing\LocalPreviewHelper::generatePreviewFromFile()).

Actions #2

Updated by Frans Saris almost 6 years ago

  • Status changed from New to Needs Feedback

If you have already the processed file just use a normal <img src="{processedFile->publicUrl}" /> tag. No need for a viewhelper.

To render the preview of a YouTube/Vimeo video just use <f:image image="{video}" width="576" height="324c" /> this will create the img tag with a process version of the video preview image.

Actions #3

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from Needs Feedback to Closed

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or open a new issue with a reference to this one.

Thank you and best regards

Actions

Also available in: Atom PDF