my.chooseImage allows users to select an image from their device's camera or photo gallery. The API returns file paths to the selected images.
my.chooseImage({
success: (res) => {
img.src = res.apFilePaths[0];
},
});
| 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). |
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Description |
|---|---|---|
apFilePaths | String Array | Image file description. |
| Error | Description |
|---|---|
11 | User cancels operation. |
sizeType parameter controls whether to return original or compressed imagessourceType parameter lets you specify camera, album, or both11