1 file.file.inc file_file_load($files)

Implements hook_file_load().

File

core/modules/file/file.file.inc, line 159
File hooks implemented by the Fil module.

Code

function file_file_load($files) {
  // Add alt and title text to images.
  $config = config('file.settings');

  $replace_options = array(
    'clear' => TRUE,
    'sanitize' => FALSE,
  );

  // Load and unserialize metadata.
  $results = db_query("SELECT * FROM {file_metadata} WHERE fid IN (:fids)", array(':fids' => array_keys($files)));

  foreach ($results as $result) {
    $name = $result->name;

    // image.module required height and width to be properties of the file.
    if ($name == 'height' || $name == 'width') {
      $files[$result->fid]->$name = unserialize($result->value);
    }

    $files[$result->fid]->metadata[$name] = unserialize($result->value);
  }
}