新增图片压缩比例设置

This commit is contained in:
wenc000 2019-09-08 22:13:47 +08:00
parent b96f87b82f
commit 1b92cc0047
2 changed files with 11 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}
}