You are here

function video_cck_veoh_thumbnail in Embedded Media Field 5

File

contrib/video_cck/providers/veoh.inc, line 82

Code

function video_cck_veoh_thumbnail($field, $item, $formatter, $node, $width, $height) {
  $thumbid = $item['value'];

  //$xml = video_cck_veoh_request($item['value']);

  //print_r($xml);

  // make the thumb index zero to follow their standard web tag format.
  // - Rysk
  $thumbnail = 'http://p-images.veoh.com/thumb.out?imageId=thumb-' . $thumbid . '-' . rand(0, 30) . '.jpg';
  if (video_cck_veoh_check_thumbnail($thumbnail) != NULL) {
    return $thumbnail;
  }
  else {
    $url = 'http://www.veoh.com/rest/video/' . $thumbid . '/details';
    $content = file_get_contents($url);
    if ($content) {
      print '(start)<br>';
      print $content;
      print '(end)<br>';
      $start = strpos($content, 'fullMedResImagePath="') + 21;
      $end = strpos($content, '"', $start);
      $thumbnail = substr($content, $start, $end - $start);
    }
    return $thumbnail;
  }
}