You are here

public function Vimeo::getRemoteThumbnailUrl in Video 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/video/Provider/Vimeo.php \Drupal\video\Plugin\video\Provider\Vimeo::getRemoteThumbnailUrl()

Get the URL of the remote thumbnail.

This is used to download the remote thumbnail and place it on the local file system so that it can be rendered with image styles. This is only called if no existing file is found for the thumbnail and should not be called unnecessarily, as it might query APIs for video thumbnail information.

Return value

string The URL to the remote thumbnail file.

Overrides ProviderPluginInterface::getRemoteThumbnailUrl

File

src/Plugin/video/Provider/Vimeo.php, line 44

Class

Vimeo
Plugin annotation @VideoEmbeddableProvider( id = "vimeo", label = @Translation("Vimeo"), description = @Translation("Vimeo Video Provider"), regular_expressions = { "/^https?:\/\/(www\.)?vimeo.com\/(?<id>[0-9]*)/", }, mimetype =…

Namespace

Drupal\video\Plugin\video\Provider

Code

public function getRemoteThumbnailUrl() {
  $data = $this
    ->getVideoMetadata();
  $video_data = json_decode(file_get_contents('http://vimeo.com/api/v2/video/' . $data['id'] . '.json'));
  if (is_object($video_data[0])) {
    return $video_data[0]->thumbnail_large;
  }
  return FALSE;
}