You are here

function oembed_file_load in oEmbed 7.0

Same name and namespace in other branches
  1. 8 oembed.file.inc \oembed_file_load()
  2. 7 oembed.file.inc \oembed_file_load()

Implements hook_file_load().

File

./oembed.file.inc, line 76

Code

function oembed_file_load($files) {
  foreach ($files as $file) {
    $scheme = file_uri_scheme($file->uri);
    if ($scheme == 'oembed') {

      // Load plain oEmbed response onto file entity.
      $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
      $file->oembed = oembed_get_data($wrapper
        ->getExternalUrl());

      // Retrieve any missing images dimensions.
      oembed_image_dimensions($file);
    }
  }
}