文件剪切、压缩路径改

segment2.0
zhanglb 2 years ago
parent 82ef9f3356
commit 90930f904d

@ -130,16 +130,17 @@ public class FileUploadServiceImpl implements IFileUploadService {
public void compressFile(String compressPath,String picPath ,Double compressWidth) {
if (Func.isNotBlank(compressPath)) {
try {
File compressFile= new File(compressPath);
File compressFile= new File(compressPath);
if (!compressFile.getParentFile().exists()) {
compressFile.getParentFile().mkdirs();
}
File compressDest = new File(saveCompressFilePath);
File compressDest = new File(compressPath);
BufferedImage image = ImageIO.read(new File(picPath));
int width = image.getWidth();
//图片压缩
ImgUtil.scale(image, FileUtil.file(compressDest), (float) (compressWidth / width));
}catch (Exception e){
log.error(e.getMessage(), e);
}finally {
}
}
@ -163,6 +164,7 @@ public class FileUploadServiceImpl implements IFileUploadService {
//剪切
ImgUtil.cut(image, FileUtil.file(cutDest), new Rectangle(0, startY, width, endY));
}catch (Exception e){
log.error(e.getMessage(), e);
}finally {
}
}

Loading…
Cancel
Save