|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|