You are here

function manualcrop_entity_update in Manual Crop 7

Implements hook_file_entity_update().

File

./manualcrop.module, line 545

Code

function manualcrop_entity_update($file, $type) {

  // This uses hook_entity_update to guarantee it comes after the revision has
  // been saved, which uses hook_file_update().
  // Bail if it's not a file or presave() did not give us new data to write.
  if ($type != 'file' || empty($file->manualcrop_data)) {
    return;
  }

  // Make a copy of revisioned data when the new revision is created so that it
  // can be cropped without harming the prior revision.
  manualcrop_save_crop_data($file, $file->manualcrop_data);
  if (variable_get('manualcrop_cache_control', TRUE)) {

    // Clear the cached image paths.
    cache_clear_all('manualcrop:', 'cache', TRUE);
  }
}