It shows I can create a model and then use image: page.previewImage So that I can display a default image from the assets folder or then display an image if it has been uploaded.
Shouldn’t kirby()->root('assets') . "/assets/images/default.jpg") just be kirby()->root('assets') . "/images/default.jpg") as root(‘assets’) will be at /assets/ anyway.
And I use query for other things, but just because it’s in the documentation unrelated to the new feature doesn’t mean it’s clear that’s how you do it.
I then have a section called albums.yml which is used to display the album in the panel. This isn’t straying too far from what is inside the starterkit already.
sections/albums.yml
# TYPE
type: pages
# HEADLINE
headline:
en: Photography
de: Photography
# TEMPLATE
template: album
# OPTIONS
empty:
en: No albums yet
de: No albums yet
image:
cover: true
ratio: 5/4
query: page.cover
info: "{{ page.images.count }} image(s)"
layout: cards
parent: kirby.page("photography")
size: tiny
pages/albums.yml
# SECTION: Unlisted
unlisted:
extends: sections/albums
status: unlisted
headline:
en: Ready For Review
de: Ready For Review
The query on the image above ‘page.cover’ doesn’t work and the preview that the panel is showing is just an icon and not the cover picture.
Where am I going wrong? (I hope this all made sense btw xD)
In the Starterkit, there is a custom page model. Is that still present in your project? In any case you have to return a file object, without the plugin you can do that with page.cover.toFile()