2

When the image is captured it saves two images, one original and the other compressed and gives the path of compressed image in image.path. How can I disable saving of any image in gallery, I just need the base64 to work with?

ImagePicker.openCamera({
  cropping: true,
  width: 300*3,
  height: 400*3,
  includeBase64: true,
  mediaType:'photo',
}).then(image => {
  console.log('received image');
  console.log(image)
})

The output is as follows:

cropRect: {height: 4128, width: 3096, y: 0, x: 0}
data: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQ"
height: 900
mime: "image/jpeg"
modificationDate: "1581938243000"
path: "file:///storage/emulated/0/Pictures/398da0f6-73ee-47ce-bfdd-8b0fa68312a5.jpg"
size: 353210
width: 675
OWS
  • 113
  • 11

1 Answers1

0

One workaround is to do delete the saved images. You can use fs package by doing

var RNFS = require('react-native-fs');
RNFS.exists(image.path)
.then(path => RNFS.unlink(path)) 

Plus, it also saves in tmp directory, so use this as well

ImagePicker.clean().then(..)
OWS
  • 113
  • 11