URL.createObjectURL gibt einen blob mit null vorangestellt. Eg : Blob:null/12415-63

blob null vorangestellt wird am Anfang zB : blob:null/72438-4637-23673-34721. Aber wenn ich das gleiche wie ein src zu dem , es zeigt das richtige Bild.

Bin ich mit URL.createObjectURL nennen. Ich habe auch versucht, mit webkitURL. Beide geben ein blob mit null an den start. Auch der blob-Wert zurückgegeben, indem Sie URL und webkitURL sind nicht das gleiche.

Hier ist das code-snippet

        var dataUrl = canvas.toDataURL();

        //The last piece of the data URL after the comma
        var byteString = atob(dataUrl.split(',')[1]);

        //Populate an array buffer
        var arrayBuffer = new ArrayBuffer(byteString.length);
        var uint8Array = new Uint8Array(arrayBuffer);
        for (var i = 0; i < byteString.length; i++) {
            uint8Array[i] = byteString.charCodeAt(i);
        }

        var blob = new Blob([uint8Array], { type: "image/png" });
        var blobVal = URL.createObjectURL(blob);

Hier die blobVal hat "blob:null/1234-5678-9012- ..."

InformationsquelleAutor stackHelp | 2015-02-07
Schreibe einen Kommentar