美文网首页
MUI单张图片压缩

MUI单张图片压缩

作者: 全村的希望iOS | 来源:发表于2018-01-21 14:43 被阅读0次

/*

* 图片压缩

*/

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() {

});

}

相关文章

网友评论

      本文标题:MUI单张图片压缩

      本文链接:https://www.haomeiwen.com/subject/bmofaxtx.html