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 5963105_www.peteralbus.com.pfx
SmsUtil.java SmsUtil.java
/src/main/resources/8128048_www.peteralbus.com.pfx /src/main/resources/8128048_www.peteralbus.com.pfx
/src/main/resources/www.peteralbus.com.pfx

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

Loading…
Cancel
Save