Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Throw error while compressing image #25

Closed
kerm1it opened this issue Aug 17, 2021 · 2 comments · Fixed by #83
Closed

[Android] Throw error while compressing image #25

kerm1it opened this issue Aug 17, 2021 · 2 comments · Fixed by #83

Comments

@kerm1it
Copy link

kerm1it commented Aug 17, 2021

When compressing image with path follow: content://media/external/images/media/78550

It throw a error: [Error: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference]

It look like content://media/external/images/media/78550 is not identified.

@numandev1
Copy link
Owner

numandev1 commented Aug 17, 2021

@kerm1it we need the absolute path for compression, if you wanna fix this issue then you can do like this for android

import RNFS from 'react-native-fs';

const destPath = `${RNFS.TemporaryDirectoryPath}/${shortid.generate()}`;
await RNFS.copyFile(selectedDocument.uri, destPath);

then you can send deskPath for compression

ref: itinance/react-native-fs#395 (comment)

@kerm1it
Copy link
Author

kerm1it commented Aug 17, 2021

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants