May 18, 2021 WeChat Mini Program Development Document
Base library 2.4.0 starts to support, and low versions need to be compatible.
Compressed picture interface, optional compression quality
Property | Type | The default | Required | Description |
---|---|---|---|---|
Src | string | Is | Picture path, picture path, support local path, code pack path | |
quality | number | 80 | Whether | Compression quality, range 0 to 100, the smaller the value, the lower the quality, the higher the compression rate (only valid for jpg). |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Property | Type | Description |
---|---|---|
tempFilePath | string | Temporary file path (local path) for compressed pictures |
wx.compressImage({
src: '', // 图片路径
quality: 80 // 压缩质量
})