export function imgurl(channel, file) {
if (file.mime === "image/svg+xml") {
return fileurl(channel, file);
}
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
return channel.filesUrl + `/thumbs/${webpPath}`;
}
export function presetUrl(channel, file, preset) {
if (file.mime === "image/svg+xml") {
return fileurl(channel, file);
}
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
return channel.filesUrl + `/templates/${preset}/${webpPath}`;
}
export function fileurl(channel, file) {
return channel.filesUrl + `/${file.path}`;
}
export function htmlurl(channel, file, preset) {
let html = "";
let url = fileurl(channel, file);
if (file.width > 0) {
let presetUrl = url;
if (preset) {
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
presetUrl = channel.filesUrl + `/templates/${preset}/${webpPath}`;
}
html = `
`;
} else if (file.mime === "image/svg+xml") {
html = `
`;
} else {
html = `${file.originalName}`;
}
return html;
}