|
@@ -50,13 +50,11 @@ public class VerifyCode {
|
|
.append(random.nextInt(10))
|
|
.append(random.nextInt(10))
|
|
.append(OPS[random.nextInt(2)])
|
|
.append(OPS[random.nextInt(2)])
|
|
.append(random.nextInt(10))
|
|
.append(random.nextInt(10))
|
|
- .append(OPS[random.nextInt(2)])
|
|
|
|
- .append(random.nextInt(10))
|
|
|
|
.toString();
|
|
.toString();
|
|
|
|
|
|
graphics.setColor(new Color(0, 0, 255));
|
|
graphics.setColor(new Color(0, 0, 255));
|
|
graphics.setFont(new Font("宋体", Font.BOLD, 22));
|
|
graphics.setFont(new Font("宋体", Font.BOLD, 22));
|
|
- graphics.drawString(verifyCode, 15, 24);
|
|
|
|
|
|
+ graphics.drawString(verifyCode, 12, 28);
|
|
graphics.dispose();
|
|
graphics.dispose();
|
|
|
|
|
|
Integer result;
|
|
Integer result;
|
|
@@ -120,16 +118,17 @@ public class VerifyCode {
|
|
final String dir = "/home/verifyCodes";
|
|
final String dir = "/home/verifyCodes";
|
|
new File(dir).mkdirs();
|
|
new File(dir).mkdirs();
|
|
|
|
|
|
- for (int n = 1; n <= 1; n++) {
|
|
|
|
|
|
+ for (int n = 1; n <= 10; n++) {
|
|
Result result = VerifyCode.generateVerifyCode();
|
|
Result result = VerifyCode.generateVerifyCode();
|
|
|
|
|
|
final String imgPath = String.format("Img_%s.jpg", n);
|
|
final String imgPath = String.format("Img_%s.jpg", n);
|
|
File imgFile = new File(dir + "/" + imgPath);
|
|
File imgFile = new File(dir + "/" + imgPath);
|
|
ImageIO.write(result.getImage(), "JPEG", imgFile);
|
|
ImageIO.write(result.getImage(), "JPEG", imgFile);
|
|
|
|
+ System.out.println(result.getResult());
|
|
|
|
|
|
byte[] bytes = imageToBytes(result.getImage());
|
|
byte[] bytes = imageToBytes(result.getImage());
|
|
String base64 = Base64Utils.encodeToString(bytes);
|
|
String base64 = Base64Utils.encodeToString(bytes);
|
|
- System.out.println(base64);
|
|
|
|
|
|
+ System.out.println(base64 + "\n");
|
|
}
|
|
}
|
|
}*/
|
|
}*/
|
|
|
|
|