mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
first test with image preview
This commit is contained in:
parent
aaaa0a720f
commit
b284ac2139
1 changed files with 27 additions and 2 deletions
|
@ -87,7 +87,15 @@ db.find({
|
||||||
if (typeof(result) !== 'undefined') {
|
if (typeof(result) !== 'undefined') {
|
||||||
result.docs.forEach(function(item) {
|
result.docs.forEach(function(item) {
|
||||||
//console.log(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) {
|
}).catch(function(err) {
|
||||||
|
@ -481,18 +489,35 @@ update_chat = function(obj) {
|
||||||
var filesize = Math.ceil(atob(obj._attachments[filename]["data"]).length) + "Bytes";
|
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 = `
|
||||||
|
<div class="card-header border-0 bg-transparent text-end p-0 mb-0 hover-overlay">
|
||||||
|
<img class="w-100 rounded-2" src="data:image/png;base64,${obj_attachments[filename]["data"]}">
|
||||||
|
<p class="text-right mb-0 p-1 text-black" style="text-align: right; font-size : 1rem">
|
||||||
|
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filename}</span>
|
||||||
|
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filesize}</span>
|
||||||
|
<i class="bi bi-filetype-${filetype}" style="font-size: 2rem;"></i>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<hr class="m-0 p-0">
|
||||||
|
`;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
var fileheader = `
|
var fileheader = `
|
||||||
<div class="card-header border-0 bg-transparent text-end p-0 mb-0 hover-overlay">
|
<div class="card-header border-0 bg-transparent text-end p-0 mb-0 hover-overlay">
|
||||||
<p class="text-right mb-0 p-1 text-black" style="text-align: right; font-size : 1rem">
|
<p class="text-right mb-0 p-1 text-black" style="text-align: right; font-size : 1rem">
|
||||||
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filename}</span>
|
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filename}</span>
|
||||||
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filesize}</span>
|
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filesize}</span>
|
||||||
<i class="bi bi-filetype-${filetype}" style="font-size: 2rem;"></i>
|
<i class="bi bi-filetype-${filetype}" style="font-size: 2rem;"></i>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<hr class="m-0 p-0">
|
<hr class="m-0 p-0">
|
||||||
`;
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var controlarea_transmit = `
|
var controlarea_transmit = `
|
||||||
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
||||||
|
|
Loading…
Reference in a new issue