|
|
|
@ -127,14 +127,14 @@ public class FileUploadServiceImpl implements IFileUploadService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void compressFile(String compressPath,String picPath,String fileName,Double compressWidth) {
|
|
|
|
|
public void compressFile(String compressPath,String picPath ,Double compressWidth) {
|
|
|
|
|
if (Func.isNotBlank(compressPath)) {
|
|
|
|
|
try {
|
|
|
|
|
File compressFileDir = new File(compressPath);
|
|
|
|
|
if (!compressFileDir.exists()) {
|
|
|
|
|
compressFileDir.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
File compressDest = new File(saveCompressFilePath+fileName);
|
|
|
|
|
File compressDest = new File(saveCompressFilePath);
|
|
|
|
|
BufferedImage image = ImageIO.read(new File(picPath));
|
|
|
|
|
int width = image.getWidth();
|
|
|
|
|
//图片压缩
|
|
|
|
@ -146,16 +146,16 @@ public class FileUploadServiceImpl implements IFileUploadService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void cutPic(String saveCutFilePath,String compressPath,String fileName,Double widthStart, Double heightStart){
|
|
|
|
|
public void cutPic(String saveCutFilePath,String compressPath ,Double widthStart, Double heightStart){
|
|
|
|
|
if (Func.isNotBlank(saveCutFilePath)) {
|
|
|
|
|
try {
|
|
|
|
|
File cutFileDir = new File(saveCutFilePath + fileName);
|
|
|
|
|
File cutFileDir = new File(saveCutFilePath);
|
|
|
|
|
if (!cutFileDir.exists()) {
|
|
|
|
|
cutFileDir.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
File cutDest = new File(saveCutFilePath + fileName);
|
|
|
|
|
File cutDest = new File(saveCutFilePath);
|
|
|
|
|
|
|
|
|
|
BufferedImage image = ImageIO.read(FileUtil.file(compressPath+fileName));
|
|
|
|
|
BufferedImage image = ImageIO.read(FileUtil.file(compressPath));
|
|
|
|
|
int height = image.getHeight();
|
|
|
|
|
int width = image.getWidth();
|
|
|
|
|
int startY = height / 100 * widthStart.intValue();
|
|
|
|
|