/*
* 圖片壓縮
*/
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%"http://縮小到原來的一半
},
function(zip) {
var target = zip.target; // 壓縮轉換后的圖片url路徑,以"file://"開頭
var size = zip.size; // 壓縮轉換后圖片的大小,單位為字節(jié)(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() {
});
}