mfg92 / hugo-shortcode-gallery

A theme component with a gallery shortcode for the static site generator hugo.
MIT License
341 stars 65 forks source link

Add support for SVG #21

Open iaeiou opened 3 years ago

iaeiou commented 3 years ago

Hi there,

here is the error I get when I add a SVG file in the images folder:

ERROR 2021/04/18 23:19:30 Rebuild failed:

ERROR 2021/04/18 23:19:30 "[...]/hugo/img/content/gallery/index.md:23:1": failed to render shortcode "gallery": failed to process shortcode: "[...]/hugo/img/themes/hugo-shortcode-gallery/layouts/shortcodes/gallery.html:89:30": execute of template failed: template: shortcodes/gallery.html:89:30: executing "shortcodes/gallery.html" at <$original.Fit>: error calling Fit: *resources.genericResource is not an image

Thanks a lot for this awesome module!

iaeiou commented 3 years ago

Maybe something to investigate here: https://discourse.gohugo.io/t/ho-do-i-convert-a-generic-resource-to-image-resource/22570/3

and there https://github.com/wowchemy/wowchemy-hugo-modules/issues/1620#issuecomment-644069059

mfg92 commented 3 years ago

Hi @iaeiou, here are my thoughts about adding support for SVG:

So it seems to me that adding SVG support is hard work, as that means the latest version of Justified Gallery has to be integrated into this project and potentially support for SVG has to be added to Swipebox (which is sadly not maintained any more). Furthermore some other special treatments of SVG would be needed, for instance you can not simple created a blurred thumbnail of a SVG.

So what i am trying to say is that adding SVG support is not a small task and possibly not even possible right now. Perhaps I miss something... PR are of course always welcome.