You are here

function imagefield_crop_file_settings in Imagefield Crop 7

Get imagefield_crop settings for a file.

1 call to imagefield_crop_file_settings()
_imagefield_add_cropinfo_fields in ./imagefield_crop.module
1 string reference to 'imagefield_crop_file_settings'
imagefield_crop_file_settings_save in ./imagefield_crop.module
Save imagefield_crop settings for a file.

File

./imagefield_crop.module, line 36
Provide a widget to crop uploaded image.

Code

function imagefield_crop_file_settings($fid) {
  $settings =& drupal_static(__FUNCTION__, array());
  if (isset($settings[$fid])) {
    return $settings[$fid];
  }
  $settings[$fid] = db_query('SELECT * FROM {imagefield_crop} WHERE fid = :fid', array(
    ':fid' => $fid,
  ))
    ->fetchAssoc();

  // We should always return an array, even if there are no settings found.
  if (!is_array($settings[$fid])) {
    $settings[$fid] = array(
      'x' => 0,
      'y' => 0,
      'width' => 50,
      'height' => 50,
      'changed' => 0,
    );
  }
  return $settings[$fid];
}