react-native-compressor
react-native-compressor copied to clipboard
getRealPath(uri, "image") bug?
Current behavior
My current code:
const res = await DocumentPicker.pickSingle({
type: [DocumentPicker.types.images],
})
let realPath = await getRealPath(res.uri, "image")
const result = await ImageCompressor.compress(realPath, {
compressionMethod: "auto",
})
getRealPath(uri, "image")
return the original uri, but with added file://
in front. When I used the uri returned from getRealPath()
on
const result = await ImageCompressor.compress(realPath, {
compressionMethod: "auto",
})
An error shows
This is the returned value from DocumentPicker.pickSIngle()
This is the returned value from getRealPath(uri, "image")
Expected behavior
getRealPath(uri, "image")
return an uri I can use for image.compress()
Platform
- [X] Android
React Native Version
0.67.2
React Native Compressor Version
1.5.2
Reproducible Steps And Demo
- Pick an image using
react-native-document-picker
in Android, it will return an uri withcontent://
- Input the uri on
getRealPath(uri, "image")
- Input the real path returned from
getRealPath(uri, "image")
onimage.compress()
@yudistiraAshadi can you tell me your android device and OS modal and can you add a reproducible GitHub example here?
@yudistiraAshadi can you tell me your android device and OS modal and can you add a reproducible GitHub example here?
This is in Android Emulator from Android Studio
@yudistiraAshadi can you tell me your android device and OS modal and can you add a reproducible GitHub example here?
I included the steps and a copy of my code on top. I hope that's enough.
@yudistiraAshadi
This is the reasoni think.. u should give permission.
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
{
title: 'Storage Permission',
message: 'App needs access to memory to upload the file ',
},
);
if (granted != PermissionsAndroid.RESULTS.GRANTED) {
Toast.show({
type: 'error',
text1: 'Permission Issue.',
text2: 'You need to give storage permission to upload the file.',
});
return false;
}
I have the same error, any updates ?
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Does this issue still exist?
fixed in the latest version, please feel free to reopen this issue again if this issue happens again