Reputation: 27
I want to convert base64 the picture to phone for save my db, i select my app in local gallery , get my data, like =>
> filename: "IMG_0005.JPG"
> height: 2002
> isStored: true
> playableDuration: 0
> uri: "assets-library://asset/asset.JPG?id=ED7AC36B-...-B6D696F4F2ED&ext=JPG"
> width: 3000
I want both ios and android to run as well, i try many library, most libraries support ios, did you know anything useful code to react-native library or another idea?
i found solution
--Edit--
import {
Image,
ImageStore,
ImageEditor,
} from 'react-native';
Image.getSize(image.uri, (width, height) => {
let imageSettings = {
offset: { x: 0, y: 0 },
size: { width: width, height: height }
};
ImageEditor.cropImage(image.uri, imageSettings, (uri) => {
ImageStore.getBase64ForTag(uri, (data) => {
console.log('base64 ==> ',data)
}, e => console.warn("getBase64ForTag: ", e))
}, e => console.warn("cropImage: ", e))
})
Upvotes: 0
Views: 459