preview: add minimal preview for albums with no images

This commit is contained in:
mappu 2023-05-20 13:43:17 +12:00
parent 0a22d1ca8a
commit b146db9d0a

View File

@ -136,16 +136,15 @@ html, body {
return
}
if len(childIDs) == 0 {
log.Printf("Failed to parse album '%s': no entries in album", fileID)
http.Error(w, "Internal error", 500)
return
albumThumb := `/nothumb_340.png`
if len(childIDs) > 0 {
albumThumb = `/thumb/m/` + childIDs[0]
}
tmpl += `
<div class="entry">
<div class="thumbnail">
<a href="` + html.EscapeString(`/p/`+strings.Join(childIDs, `-`)) + `"><img loading="lazy" src="` + html.EscapeString(`/thumb/m/`+childIDs[0]) + `"></a>
<a href="` + html.EscapeString(`/p/`+strings.Join(childIDs, `-`)) + `"><img loading="lazy" src="` + html.EscapeString(albumThumb) + `"></a>
<div class="thumbnail-overlay">` + fmt.Sprintf("%d", len(childIDs)) + ` image(s)</div>
</div>
<div class="properties">