|
@@ -98,13 +98,13 @@ public class CommonController {
|
|
|
for (MultipartFile file : files) {
|
|
|
String currentTime = DateUtil.formatDateTime(new Date());
|
|
|
//上传图片加图片水印
|
|
|
- ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
|
|
|
+ //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
|
|
|
//上传图片加文字水印
|
|
|
- ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
|
|
|
- File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
|
|
|
- FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
|
|
|
- MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
- String fileName = handleFile(mfile);
|
|
|
+ //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
|
|
|
+ //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
|
|
|
+ //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
|
|
|
+ //MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
+ String fileName = handleFile(file);
|
|
|
fileMap.put(fileName, file);
|
|
|
}
|
|
|
//2 批量上传
|
|
@@ -132,15 +132,15 @@ public class CommonController {
|
|
|
@PostMapping("upload")
|
|
|
public RestResponse upload(@RequestParam("file") MultipartFile file) {
|
|
|
Validate.notTrue(Objects.isNull(file) || file.isEmpty(), ValuePool.UPLOAD_DATA_MISSING);
|
|
|
- String currentTime = DateUtil.formatDateTime(new Date());
|
|
|
+ //String currentTime = DateUtil.formatDateTime(new Date());
|
|
|
//上传图片加图片水印
|
|
|
- ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
|
|
|
+ //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
|
|
|
//上传图片加文字水印
|
|
|
- ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
|
|
|
- File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
|
|
|
- FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
|
|
|
- MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
- String fileName = handleFile(mfile);
|
|
|
+ //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
|
|
|
+ //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
|
|
|
+ //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
|
|
|
+ //MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
+ String fileName = handleFile(file);
|
|
|
try {
|
|
|
String url = systemConfiguration.build().putObject(fileName, file.getBytes());
|
|
|
log.info("upload file complete, file URL: {}", url);
|