blowfish icon indicating copy to clipboard operation
blowfish copied to clipboard

🎨 Ability to use SVG files for author/logo image

Open didnt1able opened this issue 1 year ago • 2 comments

Would it be possible to add the ability to use SVG in place of png/jpeg. Or is there a way that i can implement this myself?

execute of template failed: template: partials/author.html:6:39: executing "partials/author.html" at <$authorImage.Fill>: error calling Fill: this method is only available for raster images. To determine if an image is SVG, you can do {{ if eq .MediaType.SubType "svg" }}{{ end }}

didnt1able avatar May 09 '23 08:05 didnt1able

@didnt1able not at this stage apparently. If you have a repo example with this so that I can check the code it would help when I take a look at it.

nunocoracao avatar May 12 '23 13:05 nunocoracao

yeah. Noticing this as well. validated with v2.40.0:

~/docker/hugoweb/themes (wpl_main)$ git submodule update --remote
Submodule path 'blowfish': checked out 'dc1ff0f998871fed05fb7a2b956cd3f1245c2643'
~/docker/hugoweb/themes (wpl_main)$ cd blowfish
~/docker/hugoweb/themes/blowfish ((v2.40.0))$ cd ../..; _local/starthugo.sh
[00:00:00] INFO: Starting LocalServer for wplhugo.example.com
[00:00:00] INFO: environment: production
[00:00:00] INFO: Binding to: http://wplhugo.example.com:80
[00:00:00] INFO: Flags:  --navigateToChanged --cleanDestinationDir --templateMetrics --templateMetricsHints --logLevel debug  --verbose --enableGitInfo --printMemoryUsage --printPathWarnings  --debug --noHTTPCache --buildDrafts --buildExpired --buildFuture
Watching for changes in ~/docker/hugoweb/{archetypes,assets,content,data,layouts,static,themes}
Watching for config changes in ~/docker/hugoweb/config/_default,~/docker/hugoweb/config/production,~/docker/hugoweb/themes/blowfish/config.toml,~/docker/hugoweb/themes/blowfish/config/_default
Start building sites … 
hugo v0.117.0-b2f0696cad918fb61420a6aff173eb36662b406e+extended darwin/amd64 BuildDate=2023-08-07T12:49:48Z VendorInfo=gohugoio

...<snip>...

ERROR render of "section" failed: "~/docker/hugoweb/themes/blowfish/layouts/_default/list.html:67:9": execute of template failed: template: _default/list.html:67:9: executing "main" at <partial "article-link/simple.html" .>: error calling partial: "~/docker/hugoweb/themes/blowfish/layouts/partials/article-link/simple.html:51:16": execute of template failed: template: partials/article-link/simple.html:51:16: executing "partials/article-link/simple.html" at <.Resize>: error calling Resize: this method is only available for raster images. To determine if an image is SVG, you can do {{ if eq .MediaType.SubType "svg" }}{{ end }}

...<snip>...

ERROR render of "home" failed: "~/docker/hugoweb/themes/blowfish/layouts/index.html:4:7": execute of template failed: template: index.html:4:7: executing "main" at <partial $partial .>: error calling partial: "~/docker/hugoweb/themes/blowfish/layouts/partials/home/background.html:60:7": execute of template failed: template: partials/home/background.html:60:7: executing "partials/home/background.html" at <partial "recent-articles/main.html" .>: error calling partial: ~/docker/hugoweb/themes/blowfish/layouts/partials/recent-articles/main.html:12:5": execute of template failed: template: partials/recent-articles/main.html:12:5: executing "partials/recent-articles/main.html" at <partial "recent-articles/cardview-fullwidth.html" .>: error calling partial: "~/docker/hugoweb/themes/blowfish/layouts/partials/recent-articles/cardview-fullwidth.html:9:7": execute of template failed: template: partials/recent-articles/cardview-fullwidth.html:9:7: executing "partials/recent-articles/cardview-fullwidth.html" at <partial "article-link/card.html" .>: error calling partial: "~/docker/hugoweb/themes/blowfish/layouts/partials/article-link/card.html:24:16": execute of template failed: template: partials/article-link/card.html:24:16: executing "partials/article-link/card.html" at <.Resize>: error calling Resize: this method is only available for raster images. To determine if an image is SVG, you can do {{ if eq .MediaType.SubType "svg" }}{{ end }}

...<snip>...

INFO  build: running step render duration 842.873783ms

as of An SVG image MAY be specified in config/_default/params.yaml for defaultBackgroundImage
however an SVG MAY NOT be specified for defaultFeaturedImage

Converting the svg to png works; but it means storing multiple copies of the same resource in dif formats.. I've not attempted to see how this plays with animated svgs/pngs yet

wolfspyre avatar Aug 15 '23 16:08 wolfspyre