Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Image Resize Frontmatter

Started by Muut Archive 10 years ago · 1 replies · 747 views
10 years ago

Hello.
I have setup a blueprint like this:
fields:
…
.Image:
type: file
label: Image
destination: ‘@self’
multiple: false
accept:
– image/*

How can I resize the placeholder like {{ image.Bild|first.path }} with .cropResize(300, 300)?

I cannot use page.media because there are some additional fields for every element (title, price, ...)

Thank you!

9 years ago

This is how I accomplished a similar thing on my site:

page.media[page.header.default_photo].cropResize(300,300)

page.header.default_photo contains the image filename. By passing the filename into page.media I found I could apply any media process to it.

I'm new to Grav so I don't know if this is the best way, but it works.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3042 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago