JavaScriptプログラムに関する各種メモ書き

HTML5 Canvas の toblob を全てのブラウザで使用する

● blueimp/JavaScript-Canvas-to-Blob

https://github.com/blueimp/JavaScript-Canvas-to-Blob

var canvas = document.createElement('canvas')
/* ... your canvas manipulations ... */
if (canvas.toBlob) {
  canvas.toBlob(function(blob) {
    // Do something with the blob object,
    // e.g. creating a multipart form for file uploads:
    var formData = new FormData()
    formData.append('file', blob, fileName)
    /* ... */
  }, 'image/jpeg')
}
No.1561
07/25 16:57

edit