问题是我需要自动从图库中获取照片。我已经读过ImagePicked用于从图像存储中获取照片,但它只是以手动方式提供(用户自己完成)。 有没有机会访问图库,列出照片并在应用程序中使用它们? 当然,如果可以按标准过滤它们(按日期范围拍照)?
答案 0 :(得分:1)
GingerComa,在Android上你可以试试这个:
import * from "file-system";
var tempPicturePath = android.os.Environment.getExternalStoragePublicDirectory(android.os.Environment.DIRECTORY_DCIM).getAbsolutePath();
var folder : Folder = Folder.fromPath(tempPicturePath);
folder.getEntities()
.then(entities => {
// entities is array with the document's files and folders.
entities.forEach(entity => {
// console.log(entity.name);
// console.log(entity.path);
// console.log(entity.lastModified);
this.folderEntities.push(
new FolderEntity(entity.name, entity.path, entity.lastModified.toString())
);
});
}).catch(err => {
// Failed to obtain folder's contents.
console.log(err.stack);
});