function imagepicker_import_form_validate in Image Picker 6.2
Same name and namespace in other branches
- 7 imagepicker.import.inc \imagepicker_import_form_validate()
Validate form
File
- ./
imagepicker.import.inc, line 176
Code
function imagepicker_import_form_validate($form, &$form_state) {
foreach ($form_state['values'] as $name => $value) {
switch ($name) {
case 'thumb':
$value = trim($value);
if (!preg_match('/^[0-9]{1,3}$/', $value) || $value <= 0) {
form_set_error($name, t('Thumbnail size should be an integer between 1 and 999.'));
}
break;
case 'scale':
$value = trim($value);
if (!preg_match('/^[0-9]{0,3}$/', $value)) {
form_set_error($name, t("Scale value should be an integer between 1 and 999 or leave it empty if you don't want to scale your image."));
}
break;
}
}
}