新增图片压缩比例设置
This commit is contained in:
parent
b96f87b82f
commit
1b92cc0047
@ -521,7 +521,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
|||||||
*/
|
*/
|
||||||
private void compressImage(String fileFullPath) {
|
private void compressImage(String fileFullPath) {
|
||||||
try {
|
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) {
|
} catch (IOException e) {
|
||||||
LOG.error(e.getMessage(), e);
|
LOG.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ public class FileProperties {
|
|||||||
private String audioTypes;
|
private String audioTypes;
|
||||||
private String fileTypes;
|
private String fileTypes;
|
||||||
private Integer maxFileCount;
|
private Integer maxFileCount;
|
||||||
|
private Double imageOutputQuality;
|
||||||
|
|
||||||
|
|
||||||
public String getUploadPath() {
|
public String getUploadPath() {
|
||||||
return uploadPath;
|
return uploadPath;
|
||||||
@ -68,4 +70,12 @@ public class FileProperties {
|
|||||||
public void setMaxFileCount(Integer maxFileCount) {
|
public void setMaxFileCount(Integer maxFileCount) {
|
||||||
this.maxFileCount = maxFileCount;
|
this.maxFileCount = maxFileCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Double getImageOutputQuality() {
|
||||||
|
return imageOutputQuality == null ? 0.4 : imageOutputQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageOutputQuality(Double imageOutputQuality) {
|
||||||
|
this.imageOutputQuality = imageOutputQuality;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user