Image manipulator package: expo-image-manipulator Camera package: expo-camera
✅Camera is working and file is created. ✅Manipulator is working and file is created. ❌When converting compressed photo to base64 format i am getting this error:
Error: Location 'file:///data/user/0/host.exp.exponent/cache/ImageManipulator/55bc375d-a4f9-4a5f-b041-2dbaccd654ca.jpg' isn't readable.
// Take photo
let photo = await camera.takePictureAsync()
// Set image
setImage(photo.uri)
const uri = photo.uri
const width = photo.width
const height = photo.height
// Process Photo
// Resize photo
const compressedPhoto = await manipulateAsync(uri, [{ resize: { width: width, height: height } }], {
compress: 0.3,
format: SaveFormat.JPEG,
})
// Convert to base64
const base64 = await FileSystem.readAsStringAsync(compressedPhoto.uri, {
encoding: FileSystem.EncodingType.Base64,
})
// Set file
setFileForAWS(new Buffer.from(base64, "base64"))
// Set file name OS + User ID + Date
setFileNameForAWS(`${Platform.OS}-${user._id}-${Date.now()}.jpg`)