feat: change the verify code image size to 120x40

This commit is contained in:
wzp 2024-12-24 17:01:24 +08:00
parent 7bb38ebaa3
commit 9e78a943c2

View File

@ -20,9 +20,9 @@ import java.util.Random;
@Component
@RequiredArgsConstructor
public class VerifyCodeUtils {
public static final int width = 240;
public static final int height = 80;
public static final int fontSize = 50;
public static final int width = 120;
public static final int height = 40;
public static final int fontSize = 25;
public static final Font mainFont = new Font("宋体", Font.BOLD, fontSize);
private final RandomUtils randomUtils;
@ -43,7 +43,7 @@ public class VerifyCodeUtils {
for (char c : text.toCharArray()) {
Random random = new Random();
setToRandomColor(g);
g.drawString(c + "", 15 + x * 40, 40 + new Random().nextInt(10));
g.drawString(c + "", 15 + x * 20, 20 + new Random().nextInt(10));
for (int j = 0; j < random.nextInt(3, 7); j++) {
setToRandomColor(g);
g.drawLine(random.nextInt(width), random.nextInt(height), random.nextInt(width), random.nextInt(height));