Project

General

Profile

Task #77085 ยป YouTubeHelper.patch

Raphael Graf, 2016-07-13 17:36

View differences:

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;
}
}
}
    (1-1/1)