Image process with Git submodule


#1

Hello,

I want to include a Git submodule in my Hugo project, which contains images (Git-LFS). The images are all high resolution (for printing), so I would like to make the images smaller for the website. The image folder is stored under “assets/common/images”, where “common” is the submodule. How can I now embed an image using shortcode? I would like to do something like this

 {{< imageresize "assets/common/images/myimage.jpg" "400px" >}}

My problem is that the images are all in one directory and I want to enter the file names and size individually, but with

<img src="{{ (.Resources.GetMatch "assets/common/images/myimage.jpg").Content | base64Encode }}">

I cannot get access to my image files.
Thanks for help


#2

Since your images live under assets, you’d need to use resources.Get instead of .Resources.GetMatch (which is for page resources).

See hugo pipes intro for examples.