未验证 提交 8295babf 编写于 作者: 潘强标 提交者: Gitee

fix getThumbnail promise

Signed-off-by: Npanqiangbiao <panqiangbiao@huawei.com>
上级 4bcc55bc
......@@ -1149,15 +1149,19 @@ getThumbnail(size?: Size): Promise&lt;image.PixelMap&gt;
async function example() {
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: fileKeyObj.DATE_ADDED + " DESC",
extendArgs: "",
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: fileKeyObj.DATE_ADDED + " DESC",
extendArgs: "",
};
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size, (err, pixelmap) => {
asset.getThumbnail(size)
.then((pixelmap) => {
console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
})
.catch((err) => {
console.info('mediaLibraryTest : getThumbnail fail'+ err);
});
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册