未验证 提交 778b9c70 编写于 作者: 潘强标 提交者: Gitee

fix getThumbnail promise

Signed-off-by: Npanqiangbiao <panqiangbiao@huawei.com>
上级 f3e55a8f
...@@ -1149,15 +1149,19 @@ getThumbnail(size?: Size): Promise&lt;image.PixelMap&gt; ...@@ -1149,15 +1149,19 @@ getThumbnail(size?: Size): Promise&lt;image.PixelMap&gt;
async function example() { async function example() {
let imageType = mediaLibrary.MediaType.IMAGE; let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = { let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
order: fileKeyObj.DATE_ADDED + " DESC", order: fileKeyObj.DATE_ADDED + " DESC",
extendArgs: "", extendArgs: "",
}; };
const fetchFileResult = await media.getFileAssets(getImageOp); const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject(); const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size, (err, pixelmap) => { asset.getThumbnail(size)
.then((pixelmap) => {
console.info('mediaLibraryTest : getThumbnail Successfull '+ 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.
先完成此消息的编辑!
想要评论请 注册