Blueprint: set new uploads template to layout/block image

Hello,

following situation I want to a achieve:

I have a blueprint with a layout field. Inside this layout the user can place an image. I used the standard kirby image block inside the layout field like this and works fine:

          portrait:
            type: layout
            label: Portraitbilder
            layouts:
              - "1/4, 1/4, 1/4, 1/4"
            fieldsets:
              - text
              - image

Now I want to extend the image block to add a specific uploads template. So the user can upload images but with the template it get converted to webp and 400x400px. My idea was this:

          portrait:
            type: layout
            label: Portraitbilder
            layouts:
              - "1/4, 1/4, 1/4, 1/4"
            fieldsets:
              - text
              - type: image
                extends: blocks/image
                fields:
                  image:
                    label: field.blocks.image.name
                    type: files
                    query: model.images
                    multiple: false
                    image:
                      back: black
                    uploads:
                      template: blocks/files/portrait
                    when:
                      location: kirby

Inside the folder site/blueprints/blocks/files/ I created the portrait.yml with following content:

title: Portrait

accept:
  extension: jpg, jpeg, webp

create:
  width: 400
  height: 400
  crop: true
  format: webp

but this doesn’t work :frowning:

So is my idea even not possible? Or what would be the way to go to get it to work?

Thanks and regards,
Timo

I’d make a copy of the bloch im site/blueprints/blocks/somename.yml

Thanks, but does this means to create a plugin for the new block?

Ok, I found another way. I added a custom block like this:

portrait:
            type: layout
            label: Portraitbilder
            layouts:
              - "1/4, 1/4, 1/4, 1/4"
            fieldsets:
              - text
              - image
              - type: portrait
                preview: fields
                name: Portrait
                icon: image
                fields:
                  portraitImage:
                    type: files
                    uploads: portrait
                    label: Bild
                    cover: true
                    ratio: 1/1
                    layout: cards

and placed the files blueprint “portrait” in the blueprint/files/potrait.yml folder and created a custom block type snippet in snippets/blocks/portrait.php

<img src="<?= $block->portraitImage()->toFile()->url() ?>" alt="" lazyload>