function imagecrop_javascript_form in Image javascript crop 6
Same name and namespace in other branches
- 5 imagecrop_actions.inc \imagecrop_javascript_form()
@file Imagecache actions implementation.
Parameters
$data values passed on by imagecache:
File
- ./
imagecrop_actions.inc, line 10 - Imagecache actions implementation.
Code
function imagecrop_javascript_form($data) {
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#required' => TRUE,
'#default_value' => $data['width'],
'#description' => t('Enter a width in pixels or as a percentage. i.e. 500 or 80%.'),
);
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#required' => TRUE,
'#default_value' => $data['height'],
'#description' => t('Enter a height in pixels or as a percentage. i.e. 500 or 80%.'),
);
$form['xoffset'] = array(
'#type' => 'textfield',
'#title' => t('X offset'),
'#default_value' => $data['xoffset'],
'#description' => t('Enter an offset in pixels or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>.'),
);
$form['yoffset'] = array(
'#type' => 'textfield',
'#title' => t('Y offset'),
'#default_value' => $data['yoffset'],
'#description' => t('Enter an offset in pixels or use a keyword: <em>top</em>, <em>center</em>, or <em>bottom</em>.'),
);
$form['resizable'] = array(
'#type' => 'checkbox',
'#title' => t('Is the toolbox resizable or not?'),
'#default_value' => $data['resizable'],
'#description' => t('If the toolbox is resized, the crop values won\'t be respected, so you should add a Scale action after the ImageCrop.'),
);
$form['downscaling'] = array(
'#type' => 'checkbox',
'#title' => t('Do not allow down scaling'),
'#default_value' => $data['downscaling'],
'#description' => t('If checked, you can\'t resize the toolbox smaller than width and height.'),
);
$description = t('Enter an aspect ratio to preserve during resizing. This can take one of the following formats:');
$description .= '<ul><li>' . t('A float (like 0.5 or 2).') . '</li>';
$description .= '<li>' . t('The string \'KEEP\'. This will constrain the aspect ratio to that of the original image.') . '</li>';
$description .= '<li>' . t('The string \'CROP\'. This will constrain the aspect ratio to the dimensions set above.') . '</li></ul>';
$description .= t('Leave blank for no aspect ratio constraints.');
$form['aspect'] = array(
'#type' => 'textfield',
'#title' => t('Aspect ratio'),
'#default_value' => $data['aspect'],
'#description' => $description,
'#element_validate' => array(
'imagecrop_validate_aspect',
),
);
$form['disable_if_no_data'] = array(
'#type' => 'checkbox',
'#title' => t('Don\'t crop if cropping region wasn\'t set.'),
'#default_value' => $data['disable_if_no_data'],
);
return $form;
}