How to get both Base64 and uri from ImagePicker

Please provide the following:

  1. SDK Version: 34.0.0
  2. Platforms(Android/iOS/web/all): iOS

I want to retrieve images from the camera roll in both base64 format as well as the uri. Currently, the ImagePicker from expo-image-picker seems to fetch only in one of the two formats at a time.

    const pickImage = async () => {
        let result = await ImagePicker.launchImageLibraryAsync({
            mediaTypes: ImagePicker.MediaTypeOptions.All,
            allowsEditing: true,
            aspect: [4, 3],
            quality: 1,
            base64: true,
        })
        
        if (!result.cancelled) {
            setImageSource(result.base64)
        }
    }

If I were to unspecify base64: true from the property, the ImagePicker fetches the uri of the image. If I were to include base64: true, only the base64 encoded format is fetched.

How do I get both the uri and base64 at the same time?

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