Feature #82855
Updated by Tobias Schmidt about 7 years ago
If you add an online media file (YouTube or Vimeo) via file list module in TYPO3 backend a preview image is saved to _typo3temp/online_media_. This file will be used as a preview image until the end of time unless it is deleted. In my use case an editor adds an online media file and later changes the preview image on the YouTube website. This new preview image will never be used in TYPO3 because there is a check for an existing preview image (@file_exists@) in method @getPreviewImage(File $file)@ in class @TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\YouTubeHelper@ (it's the same for Vimeo): <pre><code class="php"> public function getPreviewImage(File $file) { $videoId = $this->getOnlineMediaId($file); $temporaryFileName = $this->getTempFolderPath() . 'youtube_' . md5($videoId) . '.jpg'; if (!file_exists($temporaryFileName)) { $tryNames = ['maxresdefault.jpg', '0.jpg']; foreach ($tryNames as $tryName) { $previewImage = GeneralUtility::getUrl( sprintf('https://img.youtube.com/vi/%s/%s', $videoId, $tryName) ); if ($previewImage !== false) { file_put_contents($temporaryFileName, $previewImage); GeneralUtility::fixPermissions($temporaryFileName); break; } } } return $temporaryFileName; } </code></pre> </code></php> This method is called everytime a backend user opens the file list view. I suggest to call a slightly modified version of this method on online media file save without the check for an existing preview image. This way an editor would be able to update preview images without asking a administrator to delete the preview file from _typo3temp/online_media_.