修复缩略图名称获取错误

pull/1/head
lzCodeGarden 1 year ago
parent fc2ed1c78f
commit 99d9be6429

@ -53,7 +53,7 @@ public class PictureImgToLocalTask implements Runnable {
picture.setIsdownload(1);
try {
picture.setLocalThumbnailUrl(ImageUtils.generateThumbnail(pictureImgToLocal.getLocalPath(),182));
picture.setServerThumbnailUrl(ocrPictureService.getServerUrl()+ImageUtils.getFileExtension(picture.getLocalpictrueurl()));
picture.setServerThumbnailUrl(ocrPictureService.getServerUrl()+ImageUtils.getFileName(picture.getLocalpictrueurl()));
} catch (IOException e) {
throw new RuntimeException(e);
}

@ -19,7 +19,7 @@ public class ImageUtils {
if(newWidth==null){
newWidth=182;
}
String directoryPath = inputImagePath.substring(0, inputImagePath.lastIndexOf("/") + 1);
String directoryPath = inputImagePath.substring(0, inputImagePath.lastIndexOf("\\") + 1);
File inputFile = new File(inputImagePath);
String outputImagePath = directoryPath+ "thumbnail_" + inputFile.getName();
BufferedImage bufferedImage = Thumbnails.of(inputFile).scale(1).asBufferedImage();
@ -44,6 +44,13 @@ public class ImageUtils {
String url="C:\\Users\\郭向斌\\Downloads\\1-星浩.png";
String s = generateThumbnail(url,180);
System.out.println(s);
String st="http://47.93.59.251/api/image/";
String s1 = ImageUtils.generateThumbnail(url, 182);
String stri=st+getFileName(s1);
System.out.println(stri);
}
public static String getFileName(String filePath) {
File file = new File(filePath);
return file.getName();
}
}

Loading…
Cancel
Save