You are here

function file_entity_file_load in D7 Media 7

Implements hook_file_load().

File

file_entity/file_entity.module, line 223
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_file_load($files) {

  // Load images dimensions already in the {image_dimensions} table.
  $result = db_query('SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids)', array(
    ':fids' => array_keys($files),
  ));
  foreach ($result as $record) {
    $files[$record->fid]->image_dimensions = array(
      'width' => $record->width,
      'height' => $record->height,
    );
  }

  // Retrieve any missing images dimensions.
  foreach ($files as $file) {
    file_entity_image_dimensions($file, FALSE);
  }
}