Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript URL.createObjectURL返回值不是ie中的图像URL_Javascript_Image_File_Parsing_Preview - Fatal编程技术网

javascript URL.createObjectURL返回值不是ie中的图像URL

javascript URL.createObjectURL返回值不是ie中的图像URL,javascript,image,file,parsing,preview,Javascript,Image,File,Parsing,Preview,我将使文件上传图像预览系统 我使用URL.createObjectURL方法 此方法返回类型在chrome中为“blob:” 但ie返回的是“blob:AB0CC6B1-~~” 所以我不能解析输入图像 function onFileAllChanged(event){ var sizeArray=document.getElementById('fileAllUploadButton').files; if(sizeArray.length==0){ return

我将使文件上传图像预览系统 我使用URL.createObjectURL方法 此方法返回类型在chrome中为“blob:” 但ie返回的是“blob:AB0CC6B1-~~” 所以我不能解析输入图像

function onFileAllChanged(event){
    var sizeArray=document.getElementById('fileAllUploadButton').files;
    if(sizeArray.length==0){
        return;
    }else if(sizeArray.length>5){
        alert('사진은 최대 5장까지 입니다.')
        return;
    }
    for(var i=0;i<5;i++){
        var sizeImage = new Image();
        sizeImage.onload = function(){
            var width = this.width;
            var height = this.height;
            if(3000<width||3000<height){
                alert("이미지의 사이즈나 용량이 너무 큽니다.")
                while(fileList.length!=0){
                    fileList.pop();
                }
                for(var resetIndex=0;resetIndex<5;resetIndex++){
                    $('.subImage .subImageControllerBox:eq(' + resetIndex + ')').css('background-image', 'none');
                    $('.subImage .subImageControllerBox:eq(' + resetIndex + ')').attr('image-path','none');
                    $('.subImage .subImageControllerBox:eq(' + resetIndex + ')').attr('image-filter','none');
                }
                return;
            }
        };
        var path = window.URL.createObjectURL(sizeArray[i]);
        console.log('temp:'+path);
        sizeImage.src=path;
    }
    var getFormFile = document.getElementById('fileAllUploadButton').files;
    while(fileList.length!=0){
       fileList.pop();
    }
    for(var k=0;k<getFormFile.length;k++){
       fileList.push(getFormFile[k]);
    }
    for(var i=0;i<5;i++) {
        var path = URL.createObjectURL(fileList[i]);
        if(i==0){
            viewScreenImages(path,"default",i);
        }
        if(fileList[i]!=undefined) {
            $('.subImage .subImageControllerBox:eq(' + i + ')').css('background-image', 'url(' + path + ')');
            $('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-path',path);
            $('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-filter','default');
        }else{
            $('.subImage .subImageControllerBox:eq(' + i + ')').css('background-image', 'none');
            $('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-path','none');
            $('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-filter','none');
        }
    }
}
函数onFileAllChanged(事件){
var sizerray=document.getElementById('fileAllUploadButton').files;
如果(sizeArray.length==0){
返回;
}否则,如果(sizeArray.长度>5){
警惕('사진은 최대 5.장까지 입니다.')
返回;
}

对于(var i=0;i您试图解析什么?当前页面中用户从“”上传的图像我引用了以下内容:但我使用html5画布创建图像对象我看到您已经加载了图像,但我认为没有人理解您试图从图像中获取什么信息?P.S MDN:“必须通过调用URL.revokeObjectURL来释放这些信息(objectURL)当您不再需要它们时。”-您应该在
onload
回调中撤销。