image fixes

This commit is contained in:
2026-05-14 21:15:33 +03:00
parent ef29e4d261
commit 8cd80c016f
14 changed files with 180 additions and 38 deletions
+4 -2
View File
@@ -2,7 +2,8 @@ export function imgurl(channel, file) {
if (file.mime === "image/svg+xml") {
return fileurl(channel, file);
}
return channel.filesUrl + `/thumbs/${file.path}`;
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
return channel.filesUrl + `/thumbs/${webpPath}`;
}
export function fileurl(channel, file) {
@@ -16,7 +17,8 @@ export function htmlurl(channel, file, preset) {
if (file.width > 0) {
let presetUrl = url;
if (preset) {
presetUrl = channel.filesUrl + `/templates/${preset}/${file.path}`;
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
presetUrl = channel.filesUrl + `/templates/${preset}/${webpPath}`;
}
html = `<img src="${presetUrl}" alt="${file.path}" />`;
} else if (file.mime === "image/svg+xml") {