how to use ImageManupulator?

Hi everybody.
I have a issue in using expo ImageManupulation. Below is my code for compress image after taken from camera.

import * as ImageManipulator from 'expo-image-manipulator';

takePhotoFromCamera = async() => {
        let result = await ImagePicker.launchCameraAsync({
            allowsEditing: true,
            width: '100%',
            height: '100%',
            aspect: [1, 1],
        });

        if (!result.cancelled) {
            var resizedPhoto;
            if((result.width < result.height) && (result.width > 500)) {
                resizedPhoto = await ImageManipulator.manipulateAsync(result.uri, [{ resize: { width: 500 }}], { format: 'jpeg', compress: 0.5});
            } else if((result.width >= result.height) && (result.height > 500)) {
                resizedPhoto = await ImageManipulator.manipulateAsync(result.uri, [{ resize: { height: 500 }}], { format: 'jpeg', compress: 0.5});
            } else {
                resizedPhoto = result;
            }

            this.uploadAvatar(resizedPhoto.uri);
        }
    };

await ImageManupulator.manipulateAsync is not working. So don’t run uploadAvatar() function.
That is, indefinitely wait manupulateAsync so don’t run uploadAvatar() function.
I have use in sdk30 and it was worked well, but after upgrading to sdk33, above function is not work well.
And on ios it works well, it don’t work well only on android.
Anyone who know to fix this issue advance me please. Thanks

Hey @waterflower- can you try using this snack? It should work, and that’ll give you a good base to model off of!

1 Like

Thanks @charliecruzan. Your advance saved my time.
Thank you very mych.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.