Instead of the above try something like {{ $thumb := $img.Fit "600x600" }}
I tried that of course, same outcome.
“with” seems to set the context to its parameter within its scope. So in that
place “.” and “$img” should reference the very same object.
@alexandros, yeah, that was it. Sadly Hugo cannot handle webp yet, so if you reference one somewhere, as soon as you try any manipulation on it, the whole site crashes.
I issued
Why shouldn’t this apply to pngs and webp just as well? I have got lots of pngs here.
In my eyes lacking support for webp is just an oversight on hugo’s part, but I am certain this will be rectified at a certain point in the future. For what I could gather there is no real support for webp on golang, which is kind of ironic.
It’s not that you shoudn’t apply this to PNGs, it’s just that in my experience PNGs, when used appropriately, are small enough anyway to not be worth the hassle of the image processing. Your mileage, usecase and template code may wary.