[+] 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
|
||||||
@@ -47,6 +48,8 @@ const fetchApi = async () =>
|
|||||||
function getIcon(f: File)
|
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])
|
||||||
|
|||||||
Reference in New Issue
Block a user