my.compressImage
Compress large images to fulfill the size restrictions from some mini programs.
Parameters
Property | Type | Required | Description |
apFilePaths | Array | Yes | An array of the image paths to be compressed. |
compressLevel | int | No | The image quality after the compress. Valid values are:
The default value is 4. |
success | Function | No | The callback method that indicates a successful call. |
fail | Function | No | The callback method that indicates a failed call. |
complete | Function | No | The callback method that indicates the call is completed (this will be executed regardless of whether the call succeeds or fails). |
Success callback function
Property | Type | Required | Description |
apFilePaths | Array | Yes | The local file path of the compressed image. |
Error code
Error Code | Error Message | Description |
2 | Compress failed | Failed to compress all images. |
Invalid parameter | Failed to compress one of all images. |