function video_youtube_v_auto_thumbnail in Video 5
Same name and namespace in other branches
- 6 types/video_youtube/video_youtube.module \video_youtube_v_auto_thumbnail()
- 6.2 types/video_youtube/video_youtube.module \video_youtube_v_auto_thumbnail()
Implementation of hook_v_auto_thumbnail
File
- types/
video_youtube/ video_youtube.module, line 216 - Enable Youtube support for video module.
Code
function video_youtube_v_auto_thumbnail($node) {
if (count($_POST)) {
if ($_POST['vidfile'] == $node->vidfile) {
_video_image_thumbnail_debug(t('No new video to thumbnail'));
return NULL;
}
if ($_POST['tempimage']['fids']['_original']) {
_video_image_thumbnail_debug(t('Video already thumbnailed'));
return NULL;
}
$vidfile = $_POST['vidfile'];
}
else {
$vidfile = $node->vidfile;
}
//get the video id
$id = _video_youtube_get_id($vidfile);
// get thumbnail url
$thumbnail_url = _video_apiclient_youtube_get_thumbnail_url($id);
return _video_image_get_thumb_file_object($thumbnail_url, $id);
}