my.getImageInfo retrieves detailed information about an image, including its width, height, path, orientation, and format.
// Network picture path
my.getImageInfo({
src: 'https://img.example.com/example.jpg',
success: (res) => {
console.log(JSON.stringify(res));
}
});
// apFilePath from chooseImage
my.chooseImage({
success: (res) => {
my.getImageInfo({
src: res.apFilePaths[0],
success: (res) => {
console.log(JSON.stringify(res));
}
});
},
});
// Relative path
my.getImageInfo({
src: 'image/api.png',
success: (res) => {
console.log(JSON.stringify(res));
}
});
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Required | Description |
|---|---|---|---|
src | String | No | Picture path, supporting network picture path, apFilePath path and relative path. |
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 |
|---|---|---|
width | Number | Picture width (in px). |
height | Number | Picture height (in px). |
path | String | Local path of picture. |
orientation | String | Return picture orientation. Effective values are listed below. |
type | String | Return picture format. |
| Enumerator | Description |
|---|---|
up | Default. |
down | 180-Degree rotation. |
left | Rotate by 90 degree counterclockwise. |
right | Rotate by 90 degree clockwise. |
up-mirrored | Same as up except for flipping horizontally. |
down-mirrored | Same as down except for flipping horizontally. |
left-mirrored | Same as left except for flipping vertically. |
right-mirrored | Same as right except for flipping vertically. |
my.chooseImage), and relative paths