hugo-shortcode-gallery
hugo-shortcode-gallery copied to clipboard
can resources load remote images url?
hi,can resources load remote images url?
Hi, i am not sure if I understand your question correctly, but I would answer with "no".
hi my resources src is like
---
title: "My First Post"
date: 2021-09-27T08:57:03+08:00
draft: true
albumthumb: "my-first-post/1.png"
resources:
- src: "my-first-post/images/1.png"
- src: "my-first-post/images/2.png"
- src: "https://static.theviper.xyz/images/nginx-ingress-load-balance.png"
---
Hello. Is this issue closed? It's not possible to use images from an external resource like a CDN?
Currently it is not supported to use external images. PR are always welcome, but I guess it is not that easy as hugo would need to download those images during build to create downscaled thumbnails for the gallery.
It could work, I have a render hook to work with external images. The following code snippet is an excerpt from my render-image.html:
{{ $image := "" -}}
{{ $lqip := "" -}}
{{ if (urls.Parse .Destination).IsAbs }}
{{ $image = resources.GetRemote .Destination (dict
"body" `{"complete": true}`
"headers" (dict
"Content-Type" "application/json"
)
) -}}
{{ else -}}
{{ $image = .Page.Resources.GetMatch .Destination -}}
{{ end -}}
{{ with $image -}}
{{ if or (strings.HasSuffix $image "gif") (strings.HasSuffix $image "svg") }}
{{ $lqip = $image -}}
{{- else -}}
{{ $lqip = $image.Resize site.Params.lqipWidth -}}
{{ end -}}
I'd just like to ask whether the above query is dead?
It might be a good way to significantly increase the scope of the use case and at the same time increase the robustness of the gallery builds etc.
gvhconnect