Commit 73f66c49 authored by jiaorz's avatar jiaorz

验证码图片问题

parent 7c873ac9
......@@ -10,21 +10,19 @@ import java.io.File;
public class ImageUtils {
public static String getClickWordBgPath (){
String imagePath = "D:\\Downloads\\light_yan-captcha-master\\captcha\\images\\pic-click";
String path1 = Thread.currentThread().getContextClassLoader().getResource("").getPath();//获取当前资源的虚拟路径
String imagePath = path1.substring(0, path1.indexOf("target")) + "src/resources/images/pic-click";
File file = new File(imagePath);
String[] files = file.list();
int randomNum = RandomUtils.getRandomInt(1 , files.length);
String path = files[randomNum];
return imagePath+"\\" + path;
return imagePath+"/" + path;
}
public static String getBlockPuzzleBgPath (){
String imagePath = "D:\\Downloads\\light_yan-captcha-master\\captcha\\images\\jigsaw\\original";
String path1 = Thread.currentThread().getContextClassLoader().getResource("").getPath();//获取当前资源的虚拟路径
String imagePath = path1.substring(0, path1.indexOf("target")) + "src/resources/images/jigsaw/original";
File file = new File(imagePath);
String[] files = file.list();
int randomNum = RandomUtils.getRandomInt(1 , files.length);
......@@ -36,8 +34,8 @@ public class ImageUtils {
public static String getBlockPuzzleJigsawPath (){
String imagePath = "D:\\Downloads\\light_yan-captcha-master\\captcha\\images\\jigsaw\\slidingBlock";
String path1 = Thread.currentThread().getContextClassLoader().getResource("").getPath();//获取当前资源的虚拟路径
String imagePath = path1.substring(0, path1.indexOf("target")) + "src/resources/images/jigsaw/slidingBlock";
File file = new File(imagePath);
String[] files = file.list();
int randomNum = RandomUtils.getRandomInt(1 , files.length);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment