Hi.
I know you can set a “default” blueprint option for a “Files” type field.
I want to set set a default image for some “Files” type field, but not sure how I should set this.
Thanks.
Hi.
I know you can set a “default” blueprint option for a “Files” type field.
I want to set set a default image for some “Files” type field, but not sure how I should set this.
Thanks.
You can pass the path to an existing image file:
cover:
type: files
multiple: false
query: site.find("photography").children.images
default: photography/animals/abba.jpg
This only make sense, if the default image does already exist; you can’t use a default that has to be uploaded first, of course.
Thanks.
Sorry to jump in on this but can I just enter a standard file path for the default value? Like my standard assets path, e. g.: default: assets/img/default.jpg
Or is that only possible with a custom query? Because it doesn’t seem to work for me with:
meta_image:
type: files
label: Image
layout: cards
max: 1
multiple: false
query: page.images
default: assets/img/default.jpg
I haven’t tested this, but you could try a query in conjunction with a page model. If that doesn’t work, you might as well set the default image in your template if the field is not filled in.
Well, I’m not advanced enough with PHP and Kirby yet to work with page models, so I’m gonna do the template method and ignore the default value for now. Thanks