【发布时间】:2016-05-04 07:53:56
【问题描述】:
我想从图库中获取所选图像的文件名和本机路径。以下代码适用于 Android 但在 IOS 中为 null。
Titanium.Media.openPhotoGallery({
success : function(event) {
selectedImage = event.media;
//Ti.API.info("image : " + JSON.stringify(selectedImage)); --> Returns {}
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
//Ti.API.info("selectedImage : " + JSON.stringify(selectedImage)); --> Returns {}
//Ti.API.info("selectedImage : " + JSON.stringify(selectedImage.nativePath)); --> Returns null
//Ti.API.info("selectedImage.file.name : " + JSON.stringify(selectedImage.file.name)); --> Throws error
}
}
});
还有其他方法可以获取fileName、ImageType和nativePath吗?
提前致谢。
【问题讨论】:
标签: image appcelerator appcelerator-titanium photo-gallery