lazy load doesn't do anything on base64 encoded images since they are loaded as part of the HTML. Only works for additional requests.
This commit is contained in:
parent
2e9866778b
commit
1d07904459
@ -576,10 +576,10 @@ func getHref(c *cli.Context, fpath string, mtype string) (bool, string, error) {
|
||||
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' src=\"%s\" />", stype, fname)
|
||||
href = fmt.Sprintf("<img class='%s' loading='lazy' src=\"%s\" />", stype, fname)
|
||||
} else {
|
||||
href = fmt.Sprintf(
|
||||
"<figure><a href=\"%s\"><img class='thumbnail' loading='lazy' src='data:image/jpg;base64,%s'></a><figcaption>%s</figcaption></figure>",
|
||||
"<figure><a href=\"%s\"><img class='thumbnail' src='data:image/jpg;base64,%s'></a><figcaption>%s</figcaption></figure>",
|
||||
fname, thumb, caption,
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user