Task #77085 ยป YouTubeHelper.patch
typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php | ||
---|---|---|
$temporaryFileName = $this->getTempFolderPath() . 'youtube_' . md5($videoId) . '.jpg';
|
||
if (!file_exists($temporaryFileName)) {
|
||
$previewImage = GeneralUtility::getUrl(
|
||
sprintf('https://img.youtube.com/vi/%s/0.jpg', $videoId)
|
||
);
|
||
if ($previewImage !== false) {
|
||
file_put_contents($temporaryFileName, $previewImage);
|
||
GeneralUtility::fixPermissions($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;
|
||
}
|
||
}
|
||
}
|
||