ユーザーの名前、年齢、電子メール、および彼がアップロードした画像を保存するオブジェクトを作成しました。彼がアップロードした画像を div(たとえば) に表示したいのですが、この方法がわかりません。私はこれを試しました:
$(function () {
$('img').load(function () {
var canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.height;
// Copy the image contents to the canvas
var ctx = canvas.getContext("2d");
ctx.drawImage(this, 0, 0);
localStorage[this.id] = canvas.toDataURL("image/png");
})
})
しかし、javascriptまたはjqueryを使用してこの画像を表示するにはどうすればよいですか? (プラグインなし)ページに表示されるオブジェクトが5つあります。どんな解決策も役に立ちます。ありがとう