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