my.chooseImage
Choose an image from the camera or gallery of a device.
Sample Code
copy
my.chooseImage({
count: 2,
success: (res) => {
img.src = res.apFilePaths[0];
},
});Parameters
| Name | Type | Mandatory | Description |
| count | Number | No | Maximum number of images to be selected, 1 by default |
| 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:
| Name | Type | Description |
| apFilePaths | String Array | Image file description |
Error Code
| error | Description |
| 11 | User cancels operation |