Open oudengding opened 3 years ago
@Luban Hey guys, hope everything going well! That would be nice if you have time to look into this problem, thanks in advance! 🙏🏾
I encountered the same problem when I was testing on the Android 12 emulator and set back camera from VirtualScene
to Emulated
(#430 and #428), as the following code shows:
Luban.with(mContext)
.load(file)
.ignoreBy(100)
.setTargetDir(getPath())
.setCompressListener(object : OnCompressListener {
override fun onStart() {}
override fun onSuccess(compressedFile: File) {
refreshDataSource(compressedFile.path)
}
override fun onError(e: Throwable) {
e.printStackTrace()
}
})
.launch()
}
Although I invoked the setTargetDir()
method to set the compressed file directory, the original image path returned in the callback method onSuccess()
.
getPath
- /storage/emulated/0/Android/data/com.xxx.test/files/compress/Thank you again and best regards. Looking forward to the fix! 🤝
android 11, 没有使用setTargetDir()方法,压缩后返回原图片的相对路径
代码: Luban.with(context) .load(uri) .ignoreBy(100) //.setTargetDir(dir.getAbsolutePath()) .filter(path -> { return !(TextUtils.isEmpty(path)); }) .setCompressListener(onCompressCallback) .launch();
压缩后的图片:/camera_photos/Pictures/JPEG_20211011_140125.jpg