[+] UI: Display image thumbnail
This commit is contained in:
@@ -20,6 +20,7 @@ interface File {
|
|||||||
size: number
|
size: number
|
||||||
mtime: string
|
mtime: string
|
||||||
mime?: string
|
mime?: string
|
||||||
|
has_thumb?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const getType = (f: File) => f.type ?? f.file_type
|
const getType = (f: File) => f.type ?? f.file_type
|
||||||
@@ -48,6 +49,8 @@ function getIcon(f: File)
|
|||||||
{
|
{
|
||||||
if (getType(f) == "directory") return urlJoin(deployPath, "mime/folder.svg")
|
if (getType(f) == "directory") return urlJoin(deployPath, "mime/folder.svg")
|
||||||
|
|
||||||
|
if (f.has_thumb) return urlJoin(host, filePath, f.name) + "?thumb=1"
|
||||||
|
|
||||||
const sp = f.name.split(".")
|
const sp = f.name.split(".")
|
||||||
const m = f.mime ?? mime.getType(sp[sp.length - 1])
|
const m = f.mime ?? mime.getType(sp[sp.length - 1])
|
||||||
if (m) return urlJoin(deployPath, `mime/${m.replace("/", "-")}.svg`)
|
if (m) return urlJoin(deployPath, `mime/${m.replace("/", "-")}.svg`)
|
||||||
|
|||||||
Reference in New Issue
Block a user