Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Image Resize Frontmatter

Started by Muut Archive 9 years ago · 1 replies · 638 views
9 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 Deleted User, 9 years ago
0 2270 9 years ago
Archive · by Muut Archive, 9 years ago
2 1493 9 years ago
Archive · by Muut Archive, 9 years ago
2 4741 9 years ago
Archive · by Muut Archive, 9 years ago
1 3552 9 years ago
Archive · by Muut Archive, 9 years ago
3 1618 9 years ago