Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SVG #21

Open
iaeiou opened this issue Apr 18, 2021 · 2 comments
Open

Add support for SVG #21

iaeiou opened this issue Apr 18, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@iaeiou
Copy link

iaeiou commented Apr 18, 2021

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
Copy link
Author

iaeiou commented Apr 18, 2021

@mfg92
Copy link
Owner

mfg92 commented Apr 19, 2021

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

  • http://miromannino.github.io/Justified-Gallery/ (which is used by hugo-shortcode-gallery) supports SVG only since the latest version. However that version has some kind of bug (I can not remember what it was) which prevented me to upgrade.
  • I do not know if Swipebox (another dependency of this shortcode) supports SVG.
  • I does not looks like it is possible for hugo to convert SVGs to PNGs. If that would work it would allow an easy workaround.
  • Currently I get the width and height of an image from hugo and add these as attributes of the image to HTML. These attributes are used by Justified-Gallery for layouting. But this would not be possible for SVGs as hugo does not understand them.

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.

@mfg92 mfg92 added the help wanted Extra attention is needed label May 26, 2021
@mfg92 mfg92 added the enhancement New feature or request label Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants