HomeDocs
Skip to main content

dlt.saveImageToPhotosAlbum

Introduction

dlt.saveImageToPhotosAlbum saves an image to the photo album.

Parameters

Object object

PropertyTypeDefaultRequiredDescription
filePathstringYesThe file path of the image, which can be a temporary file path or a permanent file path (local path). Supports network paths.
successfunctionNoCallback function for a successful API call.
failfunctionNoCallback function for a failed API call.
completefunctionNoCallback function that will be executed when the API call is complete (both successful and failed calls).

success Callback Function

Parameters

Object res

PropertyTypeDescription
successstringtrue - successful

fail Callback Function

Parameters

Object res

PropertyTypeDescription
successstringfalse - failed
errMsgstringError code:
1. Failed saved image to album, unknown Error: SA001
2. Failed saved image to album, save failed: SA002
3.Failed saved image to album, download failed: SA003
4. Failed saved image to album, error path: SA004
5.Failed saved image to album, download result is empty: SA005

示例代码

// pages/index/index.js
Page({
saveImageToPhotosAlbum() {
dlt.saveImageToPhotosAlbum({
filePath: "xxx",
success: function (res) {
console.log("success", res);
},
fail: function (res) {
console.log("fail", res);
},
complete: function (res) {
console.log("complete", res);
},
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.