Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
1962247851 committed Jun 17, 2024
1 parent 4f0da23 commit 1ef6332
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public class UpmsConstants {
/**
* 若支持压缩,压缩到不超过1MB(1024 * 1024B)
*/
public static final int MAX_FILE_SIZE = 1024 * 1024;
public static final int MAX_COMPRESSED_FILE_SIZE = 1024 * 1024;

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Result<String> upload(@RequestParam String clientId, @RequestParam String
String dateString = DateUtil.format(LocalDateTime.now(), DatePattern.NORM_DATE_PATTERN);

// 是否需要压缩 大于1MB并且支持压缩
boolean needCompress = file.getSize() > UpmsConstants.MAX_FILE_SIZE && ThumbnailatorUtils.isSupportedOutputFormat(extName);
boolean needCompress = file.getSize() > UpmsConstants.MAX_COMPRESSED_FILE_SIZE && ThumbnailatorUtils.isSupportedOutputFormat(extName);

// 保存缩略图
if (needCompress) {
Expand All @@ -112,7 +112,7 @@ public Result<String> upload(@RequestParam String clientId, @RequestParam String
.toOutputStream(outputStream);

currentSize = outputStream.size();
} while (currentSize > UpmsConstants.MAX_FILE_SIZE);
} while (currentSize > UpmsConstants.MAX_COMPRESSED_FILE_SIZE);

outputStream.writeTo(new FileOutputStream(tempFile));

Expand Down

0 comments on commit 1ef6332

Please sign in to comment.