You are here

function _imagefield_crop_file_to_crop in Imagefield Crop 7.3

Same name and namespace in other branches
  1. 7 imagefield_crop.module \_imagefield_crop_file_to_crop()
  2. 7.2 imagefield_crop.module \_imagefield_crop_file_to_crop()
2 calls to _imagefield_crop_file_to_crop()
imagefield_crop_field_delete_revision in ./imagefield_crop.module
Implements hook_field_delete_revision().
imagefield_crop_update_7202 in ./imagefield_crop.install
Update to 7.x-3.0

File

./imagefield_crop.module, line 789

Code

function _imagefield_crop_file_to_crop($fid) {

  // Try to find the original file for this image
  $source_fid = db_select('file_usage', 'fu')
    ->fields('fu', array(
    'fid',
  ))
    ->condition('module', 'imagefield_crop')
    ->condition('type', 'file')
    ->condition('id', $fid)
    ->condition('count', 0, '>')
    ->execute()
    ->fetchField();
  if ($source_fid) {
    return file_load($source_fid);
  }
  return file_load($fid);
}