<div>
<img id="attachmentImage" />
</div>
// attachmentCntnt : this variable contains raw bytes array of the attachment image
// attachmentType : keeps the image type such as jpg/jpeg/png/...
// _.defer and _.isNull are methods from underscore.js library
var imageUrl = null;
var attachmentCntntU8Ary = new Uint8Array(attachmentCntnt);
var blob = new Blob([attachmentCntntU8Ary], { type: "image/" + attachmentType });
var urlCreator = window.URL || window.webkitURL;
imageUrl = urlCreator.createObjectURL(blob);
_.defer(function (t) {
if (!_.isNull(imageUrl)) {
var img = document.querySelector("#attachmentImage");
img.src = imageUrl;
};
}, self);
Wednesday, June 7, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment