var suofang = function (base64, bili, callback) {

    //处理缩放，转格式
    var _img = new Image();
    _img.src = base64;
    _img.onload = function () {
        var _canvas = document.createElement("canvas");


        var w = this.width / bili;
        var h = this.height / bili;


        _canvas.setAttribute("width", w);
        _canvas.setAttribute("height", h);
        _canvas.getContext("2d").drawImage(this, 0, 0, w, h);

        var base64 = _canvas.toDataURL("image/jpeg",0.8);
        _canvas.toBlob(function (blob) {

            if (blob.size > 1024 * 1024) {
                suofang(base64, bili, callback);
            } else {
                callback(blob, base64);
            }
        }, "image/jpeg");
    }
}

