Hi everyone I'm trying to make an app like an album.
Simply 2 options, Open camera, Pick from library. I can capture and pick from library ( i will show it on code).
So the problem is I want to save captured or selected image in created custom folder like ('./myAlbumPhotos'). How can I make it. This showed iamges is only cached images
installed libraries
https://www.npmjs.com/package/react-native-image-crop-picker
https://www.npmjs.com/package/react-native-image-picker
AndroidManifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera2" android:required="true"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
App.js
import React, { Component } from 'react'
import { Text, View,TouchableOpacity } from 'react-native'
import ImagePicker from 'react-native-image-crop-picker';
export default class App extends Component {
render() {
const takePhotoFromCamera = () => {
ImagePicker.openCamera({
compressImageMaxWidth: 300,
compressImageMaxHeight: 300,
cropping: true,
compressImageQuality: 0.7,
saveToPhotos :true
}).then(image => {
console.log(image);
setImage(image.path);
this.bs.current.snapTo(1);
});
}
const choosePhotoFromLibrary = () => {
ImagePicker.openPicker({
width: 300,
height: 300,
cropping: true,
compressImageQuality: 0.7
}).then(image => {
console.log(image);
setImage(image.path);
this.bs.current.snapTo(1);
});
}
return (
<View >
<TouchableOpacity onPress={takePhotoFromCamera}>
<Text >Take Photo</Text>
</TouchableOpacity>
<TouchableOpacity onPress={choosePhotoFromLibrary}>
<Text >Choose From Library</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => this.bs.current.snapTo(1)}>
<Text >Cancel</Text>
</TouchableOpacity>
</View>
)
}
}
I checked it really save photos. The question is how can I give save path. With files system ? . Thank you