|
@@ -1,6 +1,7 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileTypeUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
@@ -264,15 +265,16 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
String saveCompressImgPath = serverBasePath + imgName;
|
|
|
String ossUrl = null;
|
|
|
|
|
|
- // 使用convert压缩图片
|
|
|
- String cmd = CmdConstant.CONVERT;
|
|
|
- String size = width + "x" + height;
|
|
|
- cmd = cmd.replace("@size", size);
|
|
|
- cmd = cmd.replace("@input", inputFilePath);
|
|
|
- cmd = cmd.replace("@output", saveCompressImgPath);
|
|
|
-
|
|
|
- // 开始压缩
|
|
|
- CmdUtils.callShell(cmd);
|
|
|
+// // 使用convert压缩图片
|
|
|
+// String cmd = CmdConstant.CONVERT;
|
|
|
+// String size = width + "x" + height;
|
|
|
+// cmd = cmd.replace("@size", size);
|
|
|
+// cmd = cmd.replace("@input", inputFilePath);
|
|
|
+// cmd = cmd.replace("@output", saveCompressImgPath);
|
|
|
+//
|
|
|
+// // 开始压缩
|
|
|
+// CmdUtils.callShell(cmd);
|
|
|
+ ImgUtil.scale(FileUtil.file(inputFilePath), FileUtil.file(saveCompressImgPath), width,height,null);
|
|
|
|
|
|
|
|
|
if (FileUtil.isFile(saveCompressImgPath)) {
|