You are here

function _imagefield_crop_file_to_crop in Imagefield Crop 7.2

Same name and namespace in other branches
  1. 7.3 imagefield_crop.module \_imagefield_crop_file_to_crop()
  2. 7 imagefield_crop.module \_imagefield_crop_file_to_crop()
6 calls to _imagefield_crop_file_to_crop()
imagefield_crop_field_delete in ./imagefield_crop.module
Implements hook_field_delete().
imagefield_crop_field_delete_revision in ./imagefield_crop.module
Implements hook_field_delete_revision().
imagefield_crop_field_insert in ./imagefield_crop.module
Implements hook_field_insert().
imagefield_crop_field_update in ./imagefield_crop.module
Implements hook_field_update().
imagefield_crop_value_callback in ./imagefield_crop.module
Element value callback. Used to set crop area to image size, if image is smaller then output resolution, but validation isn't enabled.

... See full list

File

./imagefield_crop.module, line 938
Functionality and Drupal hook implementations for the Imagefield Crop module.

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, '>')
    ->range(0, 1)
    ->execute()
    ->fetchField();
  if ($source_fid) {
    return file_load($source_fid);
  }
  return file_load($fid);
}