You are here

function video_youtube_v_auto_thumbnail in Video 6.2

Same name and namespace in other branches
  1. 5 types/video_youtube/video_youtube.module \video_youtube_v_auto_thumbnail()
  2. 6 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 219
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);
  $thumbnail_url = 'http://img.youtube.com/vi/' . $id . '/2.jpg ';
  $img = _video_image_get_thumb_file_object($thumbnail_url, $id);

  //return _video_image_get_thumb_file_object($thumbnail_url, $id);
  return $img;
}