public static boolean checkImageSize(final InputStream stream,final IConfiguration conf) throws IOException {
  BufferedImage bi=ImageIO.read(stream);
  stream.close();
  if (bi == null) {
    return false;
  }
  if (bi.getHeight() > conf.getImgHeight() || bi.getWidth() > conf.getImgWidth()) {
    return false;
  }
  return true;
}

public static boolean checkImageSize ( final InputStream stream , final IConfiguration conf ) throws IOException { BufferedImage bi = ImageIO . read ( stream ) ; stream . close ( ) ; if ( bi == null ) { return false ; } if ( bi . getHeight ( ) > conf . getImgHeight ( ) || bi . getWidth ( ) > conf . getImgWidth ( ) ) { return false ; } return true ; }
check if image size isn ' t bigger then bigest allowed .
