function imagepicker_import_form in Image Picker 6.2
Same name and namespace in other branches
- 7 imagepicker.import.inc \imagepicker_import_form()
Function to display the image import form.
Parameters
$total: Required. total number of images being imported.
$account: Optional. user override
$admin: Optional. admin switch
Return value
Returns the image form.
1 string reference to 'imagepicker_import_form'
File
- ./
imagepicker.import.inc, line 76
Code
function imagepicker_import_form($form_state, $total, $account = FALSE, $admin = FALSE) {
if ($account) {
$user = $account;
}
else {
global $user;
}
// provide checkbox list of groups if any
// default watermark
$form['total'] = array(
'#type' => 'markup',
'#value' => t('!total images found in the imagepicker import folder.<br />Selected user is %user', array(
'!total' => $total,
'%user' => $user->name,
)),
);
$form['thumb'] = array(
'#type' => 'textfield',
'#title' => t('Thumbnail size'),
'#size' => 10,
'#default_value' => variable_get('imagepicker_default_thumbnail_size', 100),
'#description' => t('Size in pixels of thumbnail\'s bigger side'),
'#required' => TRUE,
);
$form['scale'] = array(
'#type' => 'textfield',
'#title' => t('Scale image'),
'#size' => 10,
'#default_value' => variable_get('imagepicker_default_scale', ''),
'#description' => t('Scale all images in this import to this size in pixels if not left empty'),
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#description' => t('Add a title to all images in this import'),
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#rows' => 2,
'#cols' => 80,
'#description' => t('Add a description to all images in this import'),
);
if (imagepicker_image_check_functions(TRUE) && variable_get('imagepicker_watermark_enable', 0)) {
if (!variable_get('imagepicker_watermark_image', '') && (isset($user->imagepicker_watermark_image) ? $user->imagepicker_watermark_image : FALSE) && isset($user->imagepicker_watermark_enable) && $user->imagepicker_watermark_enable) {
$form['watermark'] = array(
'#type' => 'checkbox',
'#title' => t('Use watermark'),
'#description' => t('Use watermark on all images in this import.'),
'#default_value' => isset($user->imagepicker_watermark_use) ? $user->imagepicker_watermark_use : FALSE,
);
}
elseif (variable_get('imagepicker_watermark_image', '')) {
$form['watermark'] = array(
'#type' => 'value',
'#value' => 1,
);
}
}
// groups
if (variable_get('imagepicker_groups_enabled', 1) && variable_get('imagepicker_groups_in_upload_enabled', 1)) {
$grouplist = imagepicker_get_groups($admin ? $user : FALSE);
if ($grouplist) {
$form['grouplist'] = array(
'#type' => 'checkboxes',
'#options' => $grouplist,
'#title' => t('Your Groups'),
'#description' => t('Select a group to add this import to.'),
);
}
}
if ($admin) {
$form['admin'] = array(
'#type' => 'value',
'#value' => 1,
);
}
if ($account) {
$form['account'] = array(
'#type' => 'value',
'#value' => $user->uid,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Import'),
);
return $form;
}