国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - So laden Sie Front-End-Base64-Bilder in Alibaba Cloud oss ??hoch
phpcn_u1582
phpcn_u1582 2017-07-05 10:26:13
0
3
2624

So laden Sie Front-End-Base64-Bilder in Alibaba Cloud oss ??hoch

phpcn_u1582
phpcn_u1582

Antworte allen(3)
滿天的星座

先把數(shù)據(jù)decode_base64, 然后通過

  • 流式上傳就直接把解出來的內(nèi)容直接上傳

  • 文件上傳,就保存為臨時(shí)文件,再按傳統(tǒng)方式上傳

習(xí)慣沉默

你現(xiàn)在是獲取到了base64的圖片了嗎 如果是的話 那就調(diào)用oss對(duì)應(yīng)的上傳接口不就好了 如果沒有獲取到base64格式的圖片 就用下面的辦法:

init : function(options) {
            var oThis = this;
            if( typeof FileReader==='undefined' ) { 
                this.imgBox.innerHTML = "抱歉,你的瀏覽器不支持 FileReader"; 
                this.file.setAttribute('disabled','disabled'); 
            } else { 
                this.file.addEventListener('change', oThis.readFile.bind(this), false); 
            } 
        },
        readFile : function(event) {
            var file = this.file.files[0],
                oThis = this;
                console.log(this);
            if ( !oThis.reg.test(file.type) ) { 
                alert("文件必須為圖片!"); 
                return; 
            } 
            var reader = new FileReader();
            reader.readAsDataURL(file); 
            reader.onload = function(e) { 
                var img = new Image(),
                    length = this.result.length,
                    result = this.result;
                img.src = result;
                img.onload = function () {
                    if ( length > oThis.maxSize ) {
                        result = oThis.compress(img);
                    } 
                    oThis.imgBox.src = result;
                    oThis.cb(result);
                };
            } 
        },
        compress : function(img) {
            var width = img.width,
                height = img.height,
                data = null;
            this.canvas.width = img.width;
            this.canvas.height = img.height;
            this.ctx.drawImage(img, 0, 0, width, height);
            data = this.canvas.toDataURL('image/jpeg', this.ratio);
            return data;
        }
女神的閨蜜愛上我

看這里 -- http://www.jianshu.com/p/665d...

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage