Auto-orient images in lightbox view

This commit is contained in:
Daniel Gasienica 2018-02-09 17:41:40 -05:00
parent 7317110809
commit 4822f49f22
1 changed files with 10 additions and 1 deletions

View File

@ -208,6 +208,13 @@
if (!this.objectUrl) {
this.objectUrl = window.URL.createObjectURL(this.blob);
}
if (this.isImage()) {
window.autoOrientImage(this.objectUrl).then(dataURL => {
this.autoOrientedImageDataURL = dataURL;
});
}
const {blob, contentType} = this;
this.view = new View(this.objectUrl, {blob, contentType});
this.view.$el.appendTo(this.$el);
@ -275,7 +282,9 @@
}
},
render_attributes: function() {
return { url: this.model.objectUrl };
return {
url: this.model.autoOrientedImageDataURL || this.model.objectUrl,
};
}
});