From e213f0792b0d52ee9e4768cd30cf7507d5d83f37 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 16 Dec 2023 21:14:27 +0100 Subject: Store image dimensions in DB --- public/gallery.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'public/gallery.js') diff --git a/public/gallery.js b/public/gallery.js index 1abb114..0967534 100644 --- a/public/gallery.js +++ b/public/gallery.js @@ -115,15 +115,20 @@ let Browse = { let ViewModel = { sha1: undefined, + width: 0, + height: 0, paths: [], tags: {}, async reload(sha1) { this.sha1 = sha1 + this.width = this.height = 0 this.paths = [] this.tags = {} let resp = await call('info', {sha1: sha1}) + this.width = resp.width + this.height = resp.height this.paths = resp.paths this.tags = resp.tags }, @@ -185,7 +190,8 @@ let View = { view(vnode) { const view = m('.view', [ ViewModel.sha1 !== undefined - ? m('img', {src: `/image/${ViewModel.sha1}`}) + ? m('img', {src: `/image/${ViewModel.sha1}`, + width: ViewModel.width, height: ViewModel.height}) : "No image.", ]) return m('.container', {}, [ -- cgit v1.2.3-70-g09d2