You are here

function video_embed_field_thumbnail_url in Video Embed Field 7.2

Gets the thumbnail url for a given video url.

Parameters

string $url: The url of the video.

Return value

string String representing the url of the thumbnail, or FALSE on error.

1 call to video_embed_field_thumbnail_url()
video_embed_field_field_presave in ./video_embed_field.field.inc
Implements hook_field_presave().

File

./video_embed_field.module, line 489
Provides a simple field for easily embedding videos from youtube or vimeo

Code

function video_embed_field_thumbnail_url($url) {
  $info = FALSE;
  if ($handler = video_embed_get_handler($url)) {
    if (isset($handler['thumbnail_function']) && function_exists($handler['thumbnail_function'])) {
      $info = call_user_func($handler['thumbnail_function'], $url);
      $info['handler'] = $handler['name'];
    }
    if (empty($info['url']) && isset($handler['thumbnail_default']) && file_exists($handler['thumbnail_default'])) {
      $info = array(
        'handler' => $handler['name'],
        'id' => 'default_thumbnail',
        'url' => $handler['thumbnail_default'],
      );
    }
  }
  return $info;
}