my.saveImage
Save the online images to a device camera gallery.
Supported types of mini programs: DSL, H5, H5+
Sample Code
copy
my.saveImage({
url: 'https://img.example.com/example.jpg',
success: (res) => {
my.alert({ title: 'saveImage Success', content: JSON.stringify(res, null, 2) })
},
fail: (err) => {
my.alert({ title: 'saveImage Failed', content: JSON.stringify(err, null, 2) })
}
});Parameters
Property | Type | Required | Description |
url | String | Yes | URL of the image to be saved. |
showActionSheet | Boolean | No | Whether to show the menu when saving image; By default, it is |
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |
Error Code
Error | Description |
2 | Invalid parameter, no url parameter transferred. |
15 | Album right not enabled (iOS only). |
16 | Insufficient album storage on cellphone (iOS only). |
17 | Other errors during picture saving. |