在ios上测试过是可以改变图片分辨率的,到了安卓这里就不行
uni.compressImage({
src: 'filePath',
quality: 100,
compressedWidth: '489px',
compressedHeight: '930px',
success: res => {
console.log(res.tempFilePath, res, 'file')
uni.uploadFile({
url: config.OSS_DOMAIN,
filePath: res.tempFilePath,
name: 'file',
formData: {
'id': this.ids
},
success: (uploadFileRes) => {
this.notice = ""
clearTimeout(this.time)
const data = JSON.parse(uploadFileRes.data)
if (data.code === 200) {
this.$emit('getPhoto', data.data.photo)
} else {
if (data.code === 1000) {
}
if (data.code === 3001) {
this.apiMsg = data.msg
this.count++
this.takePhoto()
}
}
}
});
}
})
compressedWidth 和 compressedHeight 使用数字类型