压缩成50PX 还是不行,是代码问题吗?
function uploader(path) {
var n = docompress(path);
if (n == 0) {
var wt = plus.nativeUI.showWaiting();
var server = API_URL + 'User/uploadFace';
var task = plus.uploader.createUpload(server, {
method: 'POST'
}, function(t, status) {
if (status == 200) {
hu.alert('上传成功!');
wt.close();
} else if (status == 413) {
hu.alert('头像文件太大!');
wt.close();
} else {
hu.alert('上传失败!');
wt.close();
}
});
task.addData('uid', hu.getItem('uid'));
task.addData('username', hu.getItem('username'));
task.addData('token', hu.getItem('token'));
task.addFile(path, {
key: 'love'
});
task.start();
}
else hu.alert('图片压缩失败!');
}
//图片压缩
function docompress(path) {
//压缩图片
plus.zip.compressImage({
src: path,
dst: path,
quality: 10,
width: "50px",
height: "50px",
overwrite: true
}, function() {},
function(error) {
return 1;
})
return 0;
}
TseWayne
我的没压缩图片 ,上传两张的时候可以,三张就 413 了 请问 你解决了吗
2016-02-04 10:16