fix: include links/captions for images not thumbnail'd

This commit is contained in:
decentral1se 2022-02-05 15:20:39 +01:00
parent aeb18417e6
commit 8a3fabf56e
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410

View File

@ -570,12 +570,12 @@ func getHref(c *cli.Context, fpath string, mtype string) (bool, string, error) {
}
if stype == "gif" {
href = fmt.Sprintf("<img class='gif' loading='lazy' src=\"%s\" />", fname)
href = fmt.Sprintf("<figure><a href=\"%s\"><img class='%s' loading='lazy' src=\"%s\" /></a><figcaption>%s</figcaption></figure>", fname, stype, fname, caption)
} else {
thumb, err := genThumb(c, fpath, caption)
if err != nil {
logrus.Debugf("failed to generate thumbnail for %s, showing original image", fpath)
href = fmt.Sprintf("<img class='%s' loading='lazy' src=\"%s\" />", stype, fname)
href = fmt.Sprintf("<figure><a href=\"%s\"><img class='%s' loading='lazy' src=\"%s\"/></a><figcaption>%s</figcaption></figure>", fname, stype, fname, caption)
} else {
href = fmt.Sprintf(
"<figure><a href=\"%s\"><img class='thumbnail' src='data:image/jpg;base64,%s'></a><figcaption>%s</figcaption></figure>",