ionic-framework - 图像到 base64 离子 3
问题描述
任何人都知道 TS 中的路线是什么,以便它获取图像并将其转换为 base64?是在 Facebook 上分享本地图片吗?
问候。
这是我的功能代码:
share(){
let filePath: string = "file:///assets/imgs/pesa4.jpg";
let shreface = this.actioSheetController.create({
buttons:[
{
text:"facebook",
icon:"logo-facebook",
handler:()=>{
this.base64.encodeFile(filePath).then((myBase64: string) => {
this.socialSharing.share(this.message, this.subject, myBase64, this.url)
console.log(myBase64);
})
}
}
]
});
shreface.present();
}
解决方案
尝试assets/imgs/pesa4.jpg
删除"file:///"
如果要将本地存储映像转换为 base64,请使用文件和文件选择器插件。
推荐阅读
- google-cloud-platform - 如何在 Firestore 中使用 .where() 搜索“任何”?
- google-chrome - 在 Safari 和 Chrome 中以响应式设计模式显示虚拟键盘
- ruby-on-rails - Rails 在添加新的嵌套记录时错误地解释了 http 方法
- bash - 通过打开 gnome-terminal 执行脚本后无法打印用户输入
- android - 在 Android 中实现 OpenVPN
- mysql - 为什么mysql显示两次外键值
- junit - 当响应是json格式时,有什么好的方法来测试restful api吗?
- asp.net-core - .NET Framework 项目中的 .NET Core 参考是否正确?
- sql - 根据某些条件以(HH:mm:ss)格式获取两个DateAndTime的持续时间
- javascript - JavaScript String.replace 回调以检查每隔一行