我正在使用 Nativescript imagepicker 插件在 android 中选择图像,该插件在从内部存储中选择图像时效果很好,但是从外部存储 SD 卡中选择时它返回空字符串,我到处搜索解决方案、解决方法甚至另一个插件,但仍然没有运气。无论如何在 Nativescript 中从外部存储 SD 卡中选择图像?
selectImage() {
let that = this;
let context = imagepicker.create({
mode: "single" // use "multiple" for multiple selection
});
context
.authorize()
.then(function () {
return context.present();
})
.then(function (selection) {
if (imageNumber == 1)
that.imageOneSrc = selection.length > 0 ? selection[0]['_android'] : "~/app/images/camera.png";
selection.forEach(function (element) {
element.options.width = that.secondaryImageWidth;
element.options.height = that.secondaryImageHeight;
});
}).catch(function (e) {
// process error
that.imageOneSrc = "~/app/images/camera.png";
});
}