my.chooseImage
Choose an image from the camera or gallery of a device.
Sample Code
copy
my.chooseImage({
success: (res) => {
img.src = res.apFilePaths[0];
},
});Parameters
| Property | Type | Required | Description |
| sizeType | StringArray | No | Original image, compressed image, both by default. |
| sourceType | String Array | No | Camera or album, [‘camera’,‘album’] by default. |
| 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). |
Success Callback Function
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Description |
| apFilePaths | String Array | Image file description. |
Error Code
| Error | Description |
| 11 | User cancels operation. |