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:
parent
54934f5e00
commit
204f20bf89
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue