[TASK] Add another fallback for youtube preview image 20/56420/2
authorGuido Schmechel <littlegee@web.de>
Mon, 19 Mar 2018 19:46:34 +0000 (20:46 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 22 Mar 2018 13:15:57 +0000 (14:15 +0100)
For some YouTube videos no MaxResDefaultImage is available. As a fallback
you can request the file mqdefault.jpg that has the same ratio of 16:9.

Resolves: #84483
Releases: master, 8.7
Change-Id: I31dd8b5a60a63edae7e9cc27f0049b9235fc7bd8
Reviewed-on: https://review.typo3.org/56420
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php

index d3658d0..8eb5b33 100644 (file)
@@ -48,7 +48,7 @@ class YouTubeHelper extends AbstractOEmbedHelper
         $temporaryFileName = $this->getTempFolderPath() . 'youtube_' . md5($videoId) . '.jpg';
 
         if (!file_exists($temporaryFileName)) {
-            $tryNames = ['maxresdefault.jpg', '0.jpg'];
+            $tryNames = ['maxresdefault.jpg', 'mqdefault.jpg', '0.jpg'];
             foreach ($tryNames as $tryName) {
                 $previewImage = GeneralUtility::getUrl(
                     sprintf('https://img.youtube.com/vi/%s/%s', $videoId, $tryName)