Просмотр исходного кода

[图片上传优化][修改]:图片上传优化

release_toaliyun_real
Stormeye Wu 7 лет назад
Родитель
Сommit
c3f64bc918
3 измененных файлов: 6 добавлений и 10 удалений
  1. +3
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/sys/UploadController.java
  2. +2
    -3
      mallinkBApi/src/main/java/com/iformall/controller/UploadController.java
  3. +1
    -2
      mallinkSysAdmin/src/main/java/com/iformall/controller/sys/UploadController.java

+ 3
- 5
mallinkAdmin/src/main/java/com/iformall/controller/sys/UploadController.java Просмотреть файл

@@ -176,9 +176,8 @@ public class UploadController extends BaseController {
FileOutputStream fos = null;
String imgFormat = ImgUtil.getImgFormat(fileFormat);
if(StringUtils.isNotBlank(imgFormat)) {
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
String tempFileName1 = UUID.randomUUID().toString();
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName1 + fileFormat;
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + "-1" + fileFormat;
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
BufferedInputStream fs = null;
File localFile = new File(localImgFileName);
fos = new FileOutputStream(localFile);
@@ -191,9 +190,8 @@ public class UploadController extends BaseController {
fos.close();
fs.close();
logger.info("local file: " + localImgFileName);

File newFile = ImgUtil.thinImage(localImgFileName, localNewImgFileName, imgFormat);
logger.info("local new file: " + localImgFileName);
logger.info("local new file: " + localNewImgFileName);
// 删除本地缓存
localFile.delete();
ObjectMetadata metadata = new ObjectMetadata();


+ 2
- 3
mallinkBApi/src/main/java/com/iformall/controller/UploadController.java Просмотреть файл

@@ -180,9 +180,8 @@ public class UploadController extends BaseController {

String imgFormat = ImgUtil.getImgFormat(fileFormat);
if(StringUtils.isNotBlank(imgFormat)) {
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
String tempFileName1 = UUID.randomUUID().toString();
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName1 + fileFormat;
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + "-1" + fileFormat;
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
BufferedInputStream fs = null;
File localFile = new File(localImgFileName);
fos = new FileOutputStream(localFile);


+ 1
- 2
mallinkSysAdmin/src/main/java/com/iformall/controller/sys/UploadController.java Просмотреть файл

@@ -175,8 +175,7 @@ public class UploadController extends BaseController {
FileOutputStream fos = null;
String imgFormat = ImgUtil.getImgFormat(fileFormat);
if(StringUtils.isNotBlank(imgFormat)) {
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
tempFileName = UUID.randomUUID().toString();
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + "-1" + fileFormat;
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat;
BufferedInputStream fs = null;
File localFile = new File(localImgFileName);


Загрузка…
Отмена
Сохранить