add upload preview

change to webp format
This commit is contained in:
Mystikfluu
2022-11-19 19:06:51 +01:00
parent 456a390c4c
commit a949ae3707
3 changed files with 49 additions and 97 deletions
+4 -2
View File
@@ -162,7 +162,9 @@ async function reply_link_clicked(reply_channel,reply_id) {
const image_types = {
"png":true,
"jpg":true,
"jpeg":true
"jpeg":true,
"webp":true,
"jfif":true
}
function iconLink(name) {
@@ -173,7 +175,7 @@ function iconLink(name) {
console.log(name,name.lastIndexOf("\."),name.substring(name.lastIndexOf("\.")+1));
let extension = name.substring(name.lastIndexOf("\.")+1)
if(extension in image_types) {
return "/user_uploads/"+name;
return "/user_uploads/previews/"+name;
}
return "/api/getFileIcon/"+extension
}