diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index 65edf9a..7e5969d 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -521,7 +521,7 @@ public class FileServiceImpl extends AbstractService implements IFileService { */ private void compressImage(String fileFullPath) { try { - Thumbnails.of(fileFullPath).scale(1.0f).outputQuality(0.4f).toFile(fileFullPath); + Thumbnails.of(fileFullPath).scale(1.0f).outputQuality(fileProperties.getImageOutputQuality()).toFile(fileFullPath); } catch (IOException e) { LOG.error(e.getMessage(), e); } diff --git a/cloud-common/src/main/java/com/cm/common/config/properties/FileProperties.java b/cloud-common/src/main/java/com/cm/common/config/properties/FileProperties.java index 3931c6f..54e6edd 100644 --- a/cloud-common/src/main/java/com/cm/common/config/properties/FileProperties.java +++ b/cloud-common/src/main/java/com/cm/common/config/properties/FileProperties.java @@ -20,6 +20,8 @@ public class FileProperties { private String audioTypes; private String fileTypes; private Integer maxFileCount; + private Double imageOutputQuality; + public String getUploadPath() { return uploadPath; @@ -68,4 +70,12 @@ public class FileProperties { public void setMaxFileCount(Integer maxFileCount) { this.maxFileCount = maxFileCount; } + + public Double getImageOutputQuality() { + return imageOutputQuality == null ? 0.4 : imageOutputQuality; + } + + public void setImageOutputQuality(Double imageOutputQuality) { + this.imageOutputQuality = imageOutputQuality; + } }