You are here

function _imagefield_file_load in ImageField 5.2

Same name and namespace in other branches
  1. 5 imagefield.module \_imagefield_file_load()
2 calls to _imagefield_file_load()
imagefield_field in ./imagefield.module
Implementation of hook_field().
imagefield_field_formatter in ./imagefield.module
Implementation of hook_field_formatter().

File

./imagefield.module, line 995
Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

function _imagefield_file_load($fid = null) {

  // Don't bother if we weren't passed and fid.
  if (!empty($fid) && is_numeric($fid)) {
    $result = db_query('SELECT * FROM {files} WHERE fid = %d', $fid);
    $file = db_fetch_array($result);
    if ($file) {
      return $file;
    }
  }

  // return an empty array if nothing was found.
  return array();
}