Fix bugs of photo upload.

pangu
PeterAlbus 1 year ago
parent 8e3b8badf7
commit 78cf9ebca0

1
.gitignore vendored

@ -37,3 +37,4 @@ application.yml
5963105_www.peteralbus.com.pfx
SmsUtil.java
/src/main/resources/8128048_www.peteralbus.com.pfx
/src/main/resources/www.peteralbus.com.pfx

@ -64,10 +64,10 @@ public class PhotoController
try {
// 上传的文件被保存了
file.transferTo(dest);
Thumbnails.of("/home/PeterAlbus/assets/blog/imgs/photo/"+fileName).size(200, 300).toFile("/home/PeterAlbus/assets/blog/imgs/photo/"+fileName+"_THUMB.jpg");
Thumbnails.of("/home/PeterAlbus/assets/blog/imgs/photo/"+newName).size(200, 300).toFile("/home/PeterAlbus/assets/blog/imgs/photo/"+newName+"_THUMB.jpg");
Photo photo=new Photo();
photo.setImgSrc("https://file.peteralbus.com/assets/blog/imgs/photo/"+fileName);
photo.setImgThumb("https://file.peteralbus.com/assets/blog/imgs/photo/"+fileName+"_THUMB.jpg");
photo.setImgSrc("https://file.peteralbus.com/assets/blog/imgs/photo/"+newName);
photo.setImgThumb("https://file.peteralbus.com/assets/blog/imgs/photo/"+newName+"_THUMB.jpg");
photo.setImgName(imgName);
photoService.add(photo);
return "success";
@ -109,7 +109,6 @@ public class PhotoController
Thumbnails.of(uploadPath+ saveName).size(300, 300).toFile(uploadPath+ saveName +"_THUMB.jpg");
return "https://file.peteralbus.com/assets/"+path+ saveName +"_THUMB.jpg";
} catch (IOException e) {
e.printStackTrace();
return "error:"+e.getMessage();
}
}
@ -138,7 +137,6 @@ public class PhotoController
file.transferTo(dest);
return "https://file.peteralbus.com/assets/"+path+fileName;
} catch (IOException e) {
e.printStackTrace();
return "error:"+e.getMessage();
}
}

Loading…
Cancel
Save