You are here

function imagecache_profiles_user_profile_form_validate in ImageCache Profiles 6

Custom form validation callback.

@todo: Investigage validate $op of hook_user() as this is not working correctly for the user_profile_form. See - http://drupal.org/node/239676

1 string reference to 'imagecache_profiles_user_profile_form_validate'
imagecache_profiles_form_user_profile_form_alter in ./imagecache_profiles.module
Implements hook_form_FORM_ID_alter().

File

./imagecache_profiles.module, line 246

Code

function imagecache_profiles_user_profile_form_validate($form, &$form_state) {
  if (isset($form_state['values']['picture'])) {
    $image_info = image_get_info($form_state['values']['picture']);
    if ($image_info['width'] < variable_get('user_picture_imagecache_profiles_min_width', 0) || $image_info['height'] < variable_get('user_picture_imagecache_profiles_min_height', 0)) {
      form_set_error('picture_upload', t('Your picture must be at least @min_user_picture_width pixels wide and @min_user_picture_height pixels tall (your image was @width x @height pixels).', array(
        '@min_user_picture_width' => variable_get('user_picture_imagecache_profiles_min_width', 0),
        '@min_user_picture_height' => variable_get('user_picture_imagecache_profiles_min_height', 0),
        '@width' => $image_info['width'],
        '@height' => $image_info['height'],
      )));
    }
  }
}