public function ImageCrop::addImagecropUi in Image javascript crop 7
Add all the files for the cropping UI.
File
- includes/
imagecrop.class.inc, line 593 - Imagecrop class to handle the javascript imagecrop.
Class
- ImageCrop
- @file Imagecrop class to handle the javascript imagecrop.
Code
public function addImagecropUi($in_cropping_mode) {
$path = drupal_get_path('module', 'imagecrop');
drupal_add_js($path . '/js/imagecrop.js');
drupal_add_css($path . '/css/imagecrop.css');
$popup_js = $path . '/js/popups/' . variable_get('imagecrop_popup', 'basic') . '.js';
if (file_exists($popup_js)) {
drupal_add_js($popup_js);
}
// Add crop ui if in cropping mode.
if ($in_cropping_mode) {
drupal_add_js($path . '/js/jcrop/jquery.Jcrop.js');
drupal_add_css($path . '/css/jquery.Jcrop.css');
drupal_add_js($path . '/js/imagecrop.ui.crop.js');
$settings = array(
'manipulationUrl' => url('imagecrop/generate_image'),
'cropped' => isset($_GET['cropping']),
'resizable' => $this->isResizable,
'aspectRatio' => FALSE,
'minWidth' => 0,
'minHeight' => 0,
'rotation' => variable_get('imagecrop_rotation', FALSE),
);
if ($this->isResizable) {
$settings['aspectRatio'] = $this->resizeAspectRatio;
$settings['minWidth'] = $this->downscalingAllowed ? 0 : $this->startWidth;
$settings['minHeight'] = $this->downscalingAllowed ? 0 : $this->startHeight;
$settings['startHeight'] = $this->startHeight;
$settings['startWidth'] = $this->startWidth;
}
drupal_add_js(array(
'imagecrop' => $settings,
), 'setting');
}
}