function imagepicker_copy_form in Image Picker 7
Same name and namespace in other branches
- 6.2 imagepicker.functions.inc \imagepicker_copy_form()
Function to generate the copy form
Parameters
$img_id: Required image id
$img_name: Required image name
$account: Optional $user object
$admin: Optional admin status
Return value
The form array
2 string references to 'imagepicker_copy_form'
File
- ./
imagepicker.functions.inc, line 2638 - @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function imagepicker_copy_form($form, &$form_state, $img_id, $img_name, $account = FALSE, $admin = FALSE) {
if ($account) {
$user = $account;
}
else {
global $user;
}
if ($admin) {
$form['admin'] = array(
'#type' => 'value',
'#value' => TRUE,
);
}
if ($account) {
$form['uid'] = array(
'#type' => 'value',
'#value' => $user->uid,
);
}
$form['img_id'] = array(
'#type' => 'value',
'#value' => $img_id,
);
$form['copy'] = array(
'#type' => 'fieldset',
'#title' => t('Copy'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => $img_name,
);
$form['copy']['imagepicker_copy'] = array(
'#type' => 'textfield',
'#title' => t('Copy to'),
'#size' => 25,
'#default_value' => '',
);
$form['copy']['scale'] = array(
'#type' => 'textfield',
'#title' => t('Scale image'),
'#size' => 10,
'#default_value' => imagepicker_variable_get('imagepicker_default_scale', ''),
'#description' => t('Scale image to this size in pixels if not left empty'),
);
if (imagepicker_image_check_functions(TRUE) && imagepicker_variable_get('imagepicker_watermark_enable', 0)) {
if (imagepicker_variable_get('imagepicker_watermark_enable', 0, $user->uid) && !imagepicker_variable_get('imagepicker_watermark_image', '') && imagepicker_variable_get('imagepicker_watermark_image', '', $user->uid)) {
$form['copy']['watermark'] = array(
'#type' => 'checkbox',
'#title' => t('Use watermark'),
'#description' => t('Use watermark on this image.'),
'#default_value' => imagepicker_variable_get('imagepicker_watermark_use', FALSE, $user->uid),
);
}
elseif (imagepicker_variable_get('imagepicker_watermark_image', '')) {
$form['watermark'] = array(
'#type' => 'value',
'#value' => 1,
);
}
}
$form['copy']['submit'] = array(
'#type' => 'submit',
'#value' => t('Copy image'),
);
return $form;
}