From b284ac213914746566bc71c6405d9e3596acce36 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Fri, 11 Nov 2022 15:10:31 +0100 Subject: [PATCH] first test with image preview --- gui/preload-chat.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/gui/preload-chat.js b/gui/preload-chat.js index d69a4ab0..89e97c40 100644 --- a/gui/preload-chat.js +++ b/gui/preload-chat.js @@ -87,7 +87,15 @@ db.find({ if (typeof(result) !== 'undefined') { result.docs.forEach(function(item) { //console.log(item) - update_chat(item); + // another query with attachments + db.get(item._id, { + attachments: true + }).then(function(item_with_attachments){ + //update_chat(item_with_attachments); + }); + + + }); } }).catch(function(err) { @@ -481,18 +489,35 @@ update_chat = function(obj) { var filesize = Math.ceil(atob(obj._attachments[filename]["data"]).length) + "Bytes"; } + // check if image, then display it + if(filetype == 'image/png' || filetype =="png"){ + var fileheader = ` +
+