From 1b92cc00475134b9e0323daeafdcdd04a7f9f30c Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Sun, 8 Sep 2019 22:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BE=E7=89=87=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=E6=AF=94=E4=BE=8B=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/service/file/impl/FileServiceImpl.java | 2 +- .../cm/common/config/properties/FileProperties.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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; + } }