[英]Blob to base64 encoded DataURI of type image/webp
在Firefox或IE中使用以下功能(可在Chrome和Opera中使用):
xhr = new XMLHttpRequest();
xhr.open( "GET", imgUrl + ".png", true );
xhr.responseType = "arraybuffer";
var arrayBufferView = new Uint8Array( xhr.response );
var blob = new Blob( [ arrayBufferView ], { type: "image/png" } );
我得到:
未捕獲的異常:輸入必須正確格式化為image / webp類型的base64編碼的DataURI
如何從blob轉換為image / webp類型的base64編碼的DataURI? 我對Web JavaScript不太了解,因此道歉是一個簡單的解決方法。
Internet Explorer和Firefox不支持WebP圖像格式,並且目前沒有支持它的計划。
https://bugzilla.mozilla.org/show_bug.cgi?id=webp https://bugzilla.mozilla.org/show_bug.cgi?id=856375
編輯:無論如何,此問題有完整示例的答案: 從XHR請求獲取BLOB數據
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.