Created
March 8, 2014 14:40
-
-
Save ykst/9431476 to your computer and use it in GitHub Desktop.
createObjectURLを使ったらrevokeObjectURLを呼ぶ ref: http://qiita.com/ykst/items/a367359cd4ee96cde802
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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