Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Image Resize Frontmatter

Started by Muut Archive 9 years ago · 1 replies · 520 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 1297 9 years ago
Archive · by Muut Archive, 9 years ago
2 894 9 years ago
Archive · by Muut Archive, 9 years ago
2 4024 9 years ago
Archive · by Muut Archive, 9 years ago
1 2899 9 years ago
Archive · by Muut Archive, 9 years ago
3 1082 9 years ago