function imagepicker_copy_form in Image Picker 6.2
Same name and namespace in other branches
- 7 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 2570 - Imagepicker functions
Code
function imagepicker_copy_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' => check_plain($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' => variable_get('imagepicker_default_scale', ''),
'#description' => t('Scale image to this size in pixels if not left empty'),
);
if (imagepicker_image_check_functions(TRUE) && variable_get('imagepicker_watermark_enable', 0)) {
if (!variable_get('imagepicker_watermark_image', '') && ($user->imagepicker_watermark_image ? $user->imagepicker_watermark_image : FALSE) && $user->imagepicker_watermark_enable) {
$form['copy']['watermark'] = array(
'#type' => 'checkbox',
'#title' => t('Use watermark'),
'#description' => t('Use watermark on this image.'),
'#default_value' => $user->imagepicker_watermark_use ? $user->imagepicker_watermark_use : FALSE,
);
}
elseif (variable_get('imagepicker_watermark_image', '')) {
$form['watermark'] = array(
'#type' => 'value',
'#value' => 1,
);
}
}
$form['copy']['submit'] = array(
'#type' => 'submit',
'#value' => t('Copy image'),
);
return $form;
}