You are here

function _imagefield_crop_file_to_crop in Imagefield Crop 7

Same name and namespace in other branches
  1. 7.3 imagefield_crop.module \_imagefield_crop_file_to_crop()
  2. 7.2 imagefield_crop.module \_imagefield_crop_file_to_crop()
3 calls to _imagefield_crop_file_to_crop()
imagefield_crop_widget_delete in ./imagefield_crop.module
imagefield_crop_widget_process in ./imagefield_crop.module
An element #process callback for the imagefield_crop field type.
imagefield_crop_widget_value in ./imagefield_crop.module
value callback

File

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

Code

function _imagefield_crop_file_to_crop($fid) {

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