I'm trying to resize an image using react-native-image-resizer in android and it's working fine but I want to set an output path and in the documentation, it's not clearly mentioned how to set an output path
import ImageResizer from 'react-native-image-resizer';
ImageResizer.createResizedImage(path, maxWidth, maxHeight, compressFormat, quality, rotation, outputPath)
.then(response => {
// response.uri is the URI of the new image that can now be displayed, uploaded...
// response.path is the path of the new image
// response.name is the name of the new image with the extension
// response.size is the size of the new image
})
.catch(err => {
// Oops, something went wrong. Check that the filename is correct and
// inspect err to get more details.
});
here is my code
launchImageLibrary({mediaType: 'photo'}, (img) => {
ImageResizer.createResizedImage(
img.uri, // Image path
img.width, //width
img.height, //height
img.fileName.split('.')[1], //image format
100, // quality
0, // rotation
outputPath,// I need help here
)
.then((response) => {
var image = new FormData();
image.append('file', response);
image.append('filetype', 'IMG');
// uploading image
axios({
method: 'POST',
url: `${API_URL}`,
data: image,
headers: {
mimeType: 'multipart/form-data',
},
})
.then((res) => {
alert(JSON.stringify(res));
})
.catch((err) => {
alert(`erro ${err}`);
});
});
});
I need help with the syntax. How to create a hidden folder in the Android device and set it as a outputPath.