dlt.saveImageToPhotosAlbum
Introduction
dlt.saveImageToPhotosAlbum saves an image to the photo album.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| filePath | string | Yes | The file path of the image, which can be a temporary file path or a permanent file path (local path). Supports network paths. | |
| success | function | No | Callback function for a successful API call. | |
| fail | function | No | Callback function for a failed API call. | |
| complete | function | No | Callback function that will be executed when the API call is complete (both successful and failed calls). |
success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true - successful |
fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | false - failed |
| errMsg | string | Error 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);
},
});
},
});