/*
* 图片压缩
*/
function fnImageZip(imagePath) {
alert("====>"+imagePath)
plus.zip.compressImage({
src: imagePath,
dst: '_doc/zip_'+imagePath.substr(imagePath.lastIndexOf('/') + 1),
quality: 50,//质量1-100
width:"50%",//缩小到原来的一半
height:"50%"//缩小到原来的一半
},
function(zip) {
var target = zip.target; // 压缩转换后的图片url路径,以"file://"开头
var size = zip.size; // 压缩转换后图片的大小,单位为字节(Byte)
var width = zip.width; // 压缩转换后图片的实际宽度,单位为px
var height = zip.height; // 压缩转换后图片的实际高度,单位为px
uploadHead(target); /*上传图片*/
console.log("imgPath==========>"+target);
console.log("size==========>"+size);
console.log("width==========>"+width);
console.log("height==========>"+height);
},
function() {
});
}
网友评论