- ios有什么安全限制吗?
安卓机是正常的,苹果机请求就报错
2023-01-07 - wx.compressImage压缩图片,在苹果机上无效,甚至还比原图大点
wx.chooseImage({ count: 1, sizeType: ['compressed'], sourceType: ['album', 'camera'], success: function(res) { console.log(res) var tempFilePaths = res.tempFilePaths; var sizeImg = res.tempFiles[0].size; console.log( '压缩前',sizeImg) wx.compressImage({ src: res.tempFiles[0].path, // 图片路径 quality: 86, // 压缩质量 success: function(res) { let tempFile = res.tempFilePath console.log("tempFile1", tempFile) wx.getFileInfo({ filePath: tempFile, success (res) { console.log("res", res) let picSize = res.size console.log("压缩后", picSize) // 150 (kb)=153600 (b) if( picSize <= 153600 ){ if(index == 1) { that.setData({ idCardFront: tempFilePaths }) } else { that.setData({ idCardBack: tempFilePaths }) } that.imageUpload(that, tempFilePaths, index); }else{ wx.showToast({ title: '上传图片过大,请上传不超过150kb的图片', icon:'none' }) } } }) }, fail: error => { console.log("error", error) } })
2020-12-25