|
|
@@ -108,10 +108,18 @@ public class BaseApiController extends BaseController {
|
|
|
private String compressFile(File file, String fileName) throws IOException {
|
|
|
if (fileName.contains("jpg")||fileName.contains("jpeg")||fileName.contains("bmp")
|
|
|
||fileName.contains("png")){
|
|
|
+ String filetType="jpg";
|
|
|
+ if (fileName.contains("jpeg")){
|
|
|
+ filetType="jpeg";
|
|
|
+ }else if (fileName.contains("bmp")){
|
|
|
+ filetType="bmp";
|
|
|
+ }else if (fileName.contains("png")){
|
|
|
+ filetType="png";
|
|
|
+ }
|
|
|
String thumbnailFilePathName = fileName.substring(0, fileName.lastIndexOf(".")) + "_min"+fileName.substring(fileName.lastIndexOf("."));
|
|
|
double scale = 0.4d ;
|
|
|
Thumbnails.of(file).scale(1f).outputQuality(scale)
|
|
|
- .outputFormat("jpg")
|
|
|
+ .outputFormat(filetType)
|
|
|
.toFile(uploadPath+thumbnailFilePathName);
|
|
|
FileUtils.deleteFile(uploadPath+fileName);
|
|
|
return thumbnailFilePathName;
|