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

Resize featureimages #661

Open
Productivix opened this issue Oct 25, 2023 · 0 comments
Open

Resize featureimages #661

Productivix opened this issue Oct 25, 2023 · 0 comments

Comments

@Productivix
Copy link

Productivix commented Oct 25, 2023

hi,
I want to resize images in headers,
so I modify a copy of the template file "site-header.html"
with at first :

{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/*  this is a link to an image, not the image */}}
{{ $imagetaillee := resources.Get $featured_image  }} 
{{ $imagetaillee := $imagetaillee.Resize "600x" }}

line 5 is the last line here.

I get the error when I start the built : hugo server

`Start building sites …
hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended linux/amd64 BuildDate=2023-09-24T15:20:17Z VendorInfo=snap:0.119.0

ERROR render of "section" failed: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/themes/ananke/layouts/_default/baseof.html:47:29": execute of template failed: template: _default/list.html:47:29: executing "header" at <partial "site-header.html" .>: error calling partial: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/layouts/partials/site-header.html:5:33": execute of template failed: template: partials/site-header.html:5:33: executing "partials/site-header.html" at <$imagetaillee.Resize>: nil pointer evaluating resource.Resource.Resize
Built in 140 ms
Error: error building site: render: failed to render pages: render of "section" failed: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/themes/ananke/layouts/_default/baseof.html:47:29": execute of template failed: template: _default/list.html:47:29: executing "header" at <partial "site-header.html" .>: error calling partial: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/layouts/partials/site-header.html:5:33": execute of template failed: template: partials/site-header.html:5:33: executing "partials/site-header.html" at <$imagetaillee.Resize>: nil pointer evaluating resource.Resource.Resize
`
I do not understand how to apply here the commands of the page https://gohugo.io/content-management/image-processing/

thanks for your help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant