You are here

function imagecache_profiles_user_edit_validate in ImageCache Profiles 5

Additional form validation for the user_edit form

File

./imagecache_profiles.module, line 129

Code

function imagecache_profiles_user_edit_validate($form_id, $form_values) {

  // Add a minimum size requirement to the image upload form
  if ($info = file_check_upload('picture_upload')) {
    $image_info = image_get_info($form_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('The image 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' => check_plain(variable_get('user_picture_imagecache_profiles_min_width', 0)),
        '@min_user_picture_height' => check_plain(variable_get('user_picture_imagecache_profiles_min_height', 0)),
        '@width' => $image_info['width'],
        '@height' => $image_info['height'],
      )));
    }
  }
}