You are here

function _video_apiclient_google_get_thumbnail_url in Video 6.2

Same name and namespace in other branches
  1. 5 types/video_google/video_google.module \_video_apiclient_google_get_thumbnail_url()
  2. 6 types/video_google/video_google.module \_video_apiclient_google_get_thumbnail_url()
1 call to _video_apiclient_google_get_thumbnail_url()
video_google_v_auto_thumbnail in types/video_google/video_google.module
Implementation of hook_v_auto_thumbnail

File

types/video_google/video_google.module, line 112
Enable Google Video support for video module.

Code

function _video_apiclient_google_get_thumbnail_url($id) {
  $xml = _video_apiclient_google_request($id);

  // we *should* be able to use media:thumbnail
  // but unfortunately, that is stripped out from the request hook
  // so instead, we'll parse it from the description, where it's repeated.
  // TODO: look into how to fix this...
  $desc = $xml['ITEM']['DESCRIPTION'][0];
  $regex = '@<img src="([^"]*)"@';
  if (preg_match($regex, $desc, $matches)) {
    return $matches[1];
  }
  return null;
}