[TASK] Add another fallback for youtube preview image 71/56371/3
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 08:40:59 +0000 (09:40 +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/56371
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@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)