Create another file for compressed picture with different name (#418)

* Create another file for compressed picture

For fix bug replace original image

* Update Compression.java
This commit is contained in:
Nadjib KHELIFATI 2017-08-23 15:19:42 +01:00 committed by Ivan Pusic
parent 54934f5e00
commit 204f20bf89
1 changed files with 9 additions and 1 deletions

View File

@ -53,8 +53,16 @@ public class Compression {
compressor.setMaxHeight(maxHeight);
}
File image = new File(originalImagePath);
String[] paths = image.getName().split("\\.(?=[^\\.]+$)");
String compressedFileName = paths[0] + "-compressed";
if(paths.length > 1)
compressedFileName += "." + paths[1];
return compressor
.compressToFile(new File(originalImagePath));
.compressToFile(image, compressedFileName);
}
public synchronized void compressVideo(final Activity activity, final ReadableMap options, final String originalVideo, final String compressedVideo, final Promise promise) {