function user_validate_picture
Same name and namespace in other branches
- 6.x drupal-6.x/modules/user/user.module \user_validate_picture()
Validates an image uploaded by a user.
See also
1 string reference to 'user_validate_picture'
- user_account_form in drupal-7.x/
modules/ user/ user.module - Helper function to add default user account fields to user registration and edit form.
Archivo
- drupal-7.x/
modules/ user/ user.module, line 684 - Enables the user registration and login system.
Código
function user_validate_picture(&$form, &$form_state) {
// If required, validate the uploaded picture.
$validators = array(
'file_validate_is_image' => array(),
'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
);
// Save the file as a temporary file.
$file = file_save_upload('picture_upload', $validators);
if ($file === FALSE) {
form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist or is not writable.", array('%directory' => variable_get('user_picture_path', 'pictures'))));
}
elseif ($file !== NULL) {
$form_state['values']['picture_upload'] = $file;
}
}