Skip to content

Instantly share code, notes, and snippets.

@ykst
Created March 8, 2014 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykst/9431476 to your computer and use it in GitHub Desktop.
Save ykst/9431476 to your computer and use it in GitHub Desktop.
createObjectURLを使ったらrevokeObjectURLを呼ぶ ref: http://qiita.com/ykst/items/a367359cd4ee96cde802
function loadImage(array_buffer, onload) {
var img = new Image();
img.src = URL.createObjectURL(new Blob([array_buffer], {type:'image/jpeg'}));
img.onload = function() {
onload(img); // imgを即座に使い終わる関数
URL.revokeObjectURL(img.src);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment