function gallery_assist_upload_settings in Gallery Assist 6
Menu callback for the upload settings form. A takeover from upload module.
1 call to gallery_assist_upload_settings()
- gallery_assist_settings in ./
gallery_assist.admin.inc - Settings form.
File
- ./
gallery_assist.admin.inc, line 1067 - Administration page from Gallery Assist.
Code
function gallery_assist_upload_settings($type, $settings) {
if (!empty($settings['resolution'])) {
$sizes = explode('x', $settings['resolution']);
$compare1 = $sizes[0] > $sizes[1] ? $sizes[0] : $sizes[1];
$compare2 = module_exists('imagecache') && variable_get('gallery_assist_use_imagecache', 0) == 1 ? $settings['preview_size'] : $settings['upload_prev'];
if ($compare1 < $compare2) {
$settings['resolution'] = $compare2 . 'x' . $compare2;
}
}
$form['ga_upload_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Node type upload settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#size' => -10,
);
$desc['upload']['resolution'] = t('The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an <a href="!image-toolkit-link">image toolkit</a> is installed, files exceeding this value will be scaled down to fit.', array(
'!image-toolkit-link' => url('admin/settings/image-toolkit'),
));
$form['ga_upload_settings'][$type]['gallery_assist_' . $type . '_resolution'] = array(
'#type' => 'textfield',
'#title' => t('Maximum resolution for uploaded images'),
'#default_value' => empty($settings['resolution']) ? 0 : $settings['resolution'],
'#size' => 15,
'#maxlength' => 10,
'#description' => $desc['upload']['resolution'],
'#field_suffix' => '<kbd>' . t('WIDTHxHEIGHT') . '</kbd>',
);
$desc['upload']['extensions'] = t('Extensions that users can upload. Separate extensions with a space and do not include the leading dot. Alloved are jpg jpeg gif png.');
$form['ga_upload_settings'][$type]['gallery_assist_' . $type . '_extensions'] = array(
'#type' => 'textfield',
'#title' => t('Default permitted file extensions'),
'#default_value' => $settings['extensions'],
'#maxlength' => 255,
'#description' => $desc['upload']['extensions'],
);
$desc['upload']['file_size'] = t('The default maximum file size a user can upload. If an image is uploaded and a maximum resolution is set, the size will be checked after the file has been resized. Use dot and number (.5) for an file size smoll as 1MB.');
$form['ga_upload_settings'][$type]['gallery_assist_' . $type . '_file_size'] = array(
'#type' => 'textfield',
'#title' => t('Default maximum file size per upload'),
'#default_value' => $settings['file_size'] / 1024 / 1024,
'#size' => 5,
'#maxlength' => 5,
'#description' => $desc['upload']['file_size'],
'#field_suffix' => t('MB'),
);
$desc['upload']['user_size'] = t('The default maximum size of all files a user can have on the site.');
$form['ga_upload_settings'][$type]['gallery_assist_' . $type . '_user_size'] = array(
'#type' => 'textfield',
'#title' => t('Default total file size per user'),
'#default_value' => $settings['user_size'] / 1024 / 1024,
'#size' => 5,
'#maxlength' => 5,
'#description' => $desc['upload']['user_size'],
'#field_suffix' => t('MB'),
);
$form['ga_upload_settings']['upload_max_size'] = array(
'#value' => '<p>' . t('Your PHP settings limit the maximum file size per upload to %size.', array(
'%size' => format_size(file_upload_max_size()),
)) . '</p>',
);
return $form;
}