function imagecrop_cropping_page in Image javascript crop 7
Show the cropping page for the selected image style.
Parameters
$fid fid from file to be cropped:
$style_name Style that is being changed:
$entity_type entity type from the field that triggered the imagecrop overview:
$bundle bundle from the field that triggered the imagecrop overview:
$field_name Field name that triggered the imagecrop overview.:
1 string reference to 'imagecrop_cropping_page'
- imagecrop_menu in ./
imagecrop.module - Implements hook_menu().
File
- includes/
imagecrop.admin.inc, line 199 - Administration tools for the imagecrop module.
Code
function imagecrop_cropping_page($fid, $style_name, $entity_type = NULL, $bundle = NULL, $field_name = NULL) {
try {
$styles = imagecrop_get_enabled_styles_for_crop($entity_type, $bundle, $field_name);
global $user;
$imagecrop = new ImageCrop();
$imagecrop
->loadFile($fid);
$imagecrop
->setImageStyle($style_name);
$imagecrop
->setEntityType($entity_type);
$imagecrop
->setBundle($bundle);
$imagecrop
->setFieldName($field_name);
$imagecrop
->setInCroppingMode(TRUE);
$imagecrop
->setCropDestinations();
global $user;
if (!$imagecrop
->hasUserAccess($user)) {
watchdog('imagecrop', 'Access denied for user @name on fid @fid', array(
'@name' => $user->name,
'@fid' => $imagecrop
->getFile()->fid,
));
throw new Exception(t("You don't have permissions to crop this image."));
}
$imagecrop
->loadCropSettings();
$imagecrop
->writeCropreadyImage();
$imagecrop
->addImagecropUi(TRUE);
$params = array(
'style_selection' => drupal_get_form('imagecrop_style_selection_form', $styles, $imagecrop),
'settings_form' => drupal_get_form('imagecrop_crop_settings_form', $imagecrop),
'scale_form' => drupal_get_form('imagecrop_scale_settings_form', $imagecrop),
'imagecrop' => $imagecrop,
);
if (variable_get('imagecrop_rotation')) {
$params['rotation_form'] = drupal_get_form('imagecrop_rotation_settings_form', $imagecrop);
}
return theme($imagecrop->extraControls ? 'imagecrop_crop_ui_advanced' : 'imagecrop_crop_ui', $params);
} catch (Exception $e) {
drupal_set_message(check_plain($e
->getMessage()), 'error');
return '';
}
}