Closed stivenm16 closed 1 year ago
I ran into this issue too, my problem was that I was using the wrong development client. I don't know if you are using a custom development client but if you are this might be the issue.
Hi @stivenm16 ,
I tried to reproduce it in the example app and I have no problem:
// App.tsx
const resize = async () => {
if (!image || !image.uri) return;
setResizedImage(null);
try {
let result = await ImageResizer.createResizedImage(
image.uri,
sizeTarget,
sizeTarget,
'JPEG',
80,
0,
undefined
);
setResizedImage(result);
} catch (error) {
Alert.alert('Unable to resize the photo');
}
};
Did you find the issue? Do you have a reproducible example?
I'm getting this error too..
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Thank you for your contributions.
Am getting error as well
I'm getting this error too.. did you find a fix?
@taboulot
am also getting the error [TypeError: null is not an object (evaluating 'ImageResizer.createResizedImage')]
my uri is as file:///data/user/0/com.cashlet.development/cache/Camera/2ad1e650-c2ba-435f-bc3e-628cb67737e7.jpg
my usage
const data = await camera.takePictureAsync(options); console.log(data.uri); if (data && data?.uri) { try { let result = await ImageResizer.createResizedImage( data?.uri, 80, 80, 'JPEG', 70, 0, undefined, false, { mode: 'contain', onlyScaleDown: true, }, ); console.log(result?.size, result.uri, 'image'); // addKYCUserDetails(result?.uri, 'idImage'); // this.setState({screen: 'retake'}); } catch (error: any) { console.log(error); Alert.alert(error); } }
I also get the following error on the screen
I ran into this issue too, my problem was that I was using the wrong development client. I don't know if you are using a custom development client but if you are this might be the issue.
@caiogmar what do you mean custom development client?
Got it! In my case I reinstalled nodemodules and rebuild my dev client again, I guess its an issue with linking
I'm getting this error when I tried to resize an img, I'm following docs but the error persists. Here the code:
const res = await ImageResizer.createResizedImage( uri, sizeTarget, sizeTarget, "JPEG", 80, 0, undefined ) .then((response) => { const { name, uri } = response; const base64 = FileSystem.readAsStringAsync(uri, EncodingType.Base64); return { name, base64 }; }) .catch((e) => { console.log(e); });
The App stops before encoding and throw
[TypeError: null is not an object (evaluating 'ImageResizer.createResizedImage')] Unable to resize
I'm running my app on Android