问题是我需要自动从图库中获取照片。我读过 ImagePick 用于从图像存储中获取照片,但它仅以手动方式提供(用户自行完成(。是否有机会访问图库,拍摄照片列表并在应用程序中使用它们?当然,是否可以按条件过滤它们(按日期范围获取照片(?
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);
});