Javascript 如何将图像文件加载到JQuery中?

Javascript 如何将图像文件加载到JQuery中?,javascript,jquery,parse-platform,Javascript,Jquery,Parse Platform,我使用url从解析中检索图像,如下所示 var imgPaht = user.get("ProfilePic"); $('<img src="' + imgPaht + '">').load(function() { $(this).width(400).height(400).appendTo('#profile_pic'); }) 我犯了一个错误 编码图像文件数据不会直接插入到img tags src属性中。必须首先将其解码为原始图像数据,然

我使用url从解析中检索图像,如下所示

var imgPaht = user.get("ProfilePic");

    $('<img src="' + imgPaht + '">').load(function() {
        $(this).width(400).height(400).appendTo('#profile_pic');
    })
我犯了一个错误

编码图像文件数据不会直接插入到img tags src属性中。必须首先将其解码为原始图像数据,然后将其分配给以数据为前缀的src属性:


有关如何执行此操作的更多信息,请参阅。

这里可能回答了这个问题:但不使用/需要jQuery,只使用纯JS。当您说file是Base64时,答案是什么?还是其他?@RokoC.Buljan我查过了,它肯定是个物体。。。
var profilePhoto = profile.get("ProfilePic");
$("profileImg")[0].src = profilePhoto.url();