我想将base64图片转换为手机以保存数据库, 我在本地图库中选择我的应用,获取数据,例如=>
> filename: "IMG_0005.JPG"
> height: 2002
> isStored: true
> playableDuration: 0
> uri: "assets-library://asset/asset.JPG?id=ED7AC36B-...-B6D696F4F2ED&ext=JPG"
> width: 3000
我希望同时运行ios和android,我尝试了许多库,大多数库都支持ios,您知道有用的代码来响应本机库还是其他想法?
我找到了解决办法
-编辑-
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))
})