Hugo 0.56.1 and Image Resize

My Hugo bases website makes use of the Image .Resize and .Fit Operations to generated different sized images for the article covers and gallery thumbnails.

This works using Hugo 0.55.6 but fails with 0.56.1

Hugo reports the .ResourceType as “image”, therefore I would expect Hugo to be able to resize as expected.

Do you get an error?

Possibly related to what @brunoamaral experienced

One question: What extension do you use for your images: *.jpg or *.JPG or *.JPEG?

I say this because we made a change in the way we do MIME resolution. I have a nagging feeling that it is identified as an image named image.JPG, but it fails to resolve the converter (because that use the filename’s extension).

I will create an issue about this and figure out a proper fix, but in the meantime the workaround is to make sure that your images are named sunset.jpg, logo.png (e.g. lower case extensions).

I’ve mostly used .jpg Images but there is one .JPG and one .jpeg image in my list of article cover images.

There is an error message displayed as Hugo stops processing the templates.

Gwenfrewi:avd_infopoint ralf$ docker run --rm -it -v /Users/ralf/git/avd_infopoint:/src -p 1313:1313 hugo:0.56.1 hugo --verbose --verboseLog
Total in 6034 ms
Error: Error building site: failed to render pages: render of "home" failed: "/src/themes/hugo-theme-avd/layouts/index.html:15:31": execute of template failed: template: index.html:38:5: executing "index.html" at <partial "news.html" .>: error calling partial: "/src/themes/hugo-theme-avd/layouts/partials/news.html:15:31": execute of template failed: template: partials/news.html:15:31: executing "partials/news.html" at <$resource.Resize>: can't evaluate field Resize in type *resources.genericResource

I have fixed the upper case issue in master, will release 0.56.2 later today.

1 Like

BTW: it would make debugging issues much easier, if there is some chance to “print” into the generators output. I had some problems with Hugo not able to proceed in generating the templates so there was no chance to have a look Ito the generated HTML.

I just created a new hugo installation and this problem is obviously solved in 0.56.2.

Gwenfrewi:avd_infopoint ralf$ hugo version
Hugo Static Site Generator v0.56.2-5F033A7F linux/amd64 BuildDate: 2019-07-30T09:08:21Z

Gwenfrewi:avd_infopoint ralf$ hugo-serve
INFO 2019/07/30 13:17:06 No translation bundle found for default language "en"
INFO 2019/07/30 13:17:06 Translation func for language en not found, use default.
INFO 2019/07/30 13:17:06 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2019/07/30 13:17:07 Using config file: 
Building sites … INFO 2019/07/30 13:17:07 syncing static files to /
INFO 2019/07/30 13:17:08 found taxonomies: map[string]string{"category":"categories", "tag":"tags"}
INFO 2019/07/30 13:17:22 found no layout file for "HTML" for "404": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   | EN   
+------------------+-----+
  Pages            | 100  
  Paginator pages  |   0  
  Non-page files   | 181  
  Static files     |  78  
  Processed images | 103  
  Aliases          |   0  
  Sitemaps         |   1  
  Cleaned          |   0  

Total in 15868 ms
Watching for changes in /src/{content,data,static,themes}
Watching for config changes in /src/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://0.0.0.0:1313/avd/ (bind address 0.0.0.0)
Press Ctrl+C to stop