You are here

public function MediaInternetFlickrHandler::getOEmbed in Media: Flickr 7.2

Returns information about the media.

See http://www.oembed.com.

Return value

If oEmbed information is available, an array containing 'title', 'type', 'url', and other information as specified by the oEmbed standard. Otherwise, NULL.

1 call to MediaInternetFlickrHandler::getOEmbed()
MediaInternetFlickrHandler::getFileObject in includes/MediaInternetFlickrHandler.inc

File

includes/MediaInternetFlickrHandler.inc, line 46
Extends the MediaInternetBaseHandler class to handle Flickr images.

Class

MediaInternetFlickrHandler
Implementation of MediaInternetBaseHandler.

Code

public function getOEmbed() {
  $uri = $this
    ->parse($this->embedCode);
  $external_url = drupal_realpath($uri);
  $oembed_url = url('https://www.flickr.com/services/oembed', array(
    'query' => array(
      'url' => $external_url,
      'format' => 'json',
    ),
  ));
  $response = drupal_http_request($oembed_url);
  if (!isset($response->error)) {
    return drupal_json_decode($response->data);
  }
  else {
    throw new Exception("Error Processing Request. (Error: {$response->code}, {$response->error})");
    return;
  }
}