Images not migrated from Kirby 2 to 3

I am currently trying to migrate my website from Kirby 2 to Kirby 3. It hasn’t exactly been easy for me, but so far so good. However, I have a bunch of projects that have images associated with them.

The folder structure is like this:

home
projects
    1_project-name
        project.txt
        imagename.jpg
        imagename.jpg.txt
    2_project-name
        project.txt
        imagename.jpg
        imagename.jpg.txt

This is my project.yml template:

title: Project
preset: page

status:
  draft: Draft
  listed: Published

fields:
  title:
    type: text
    required: true
    headline: Titel
  text:
    type: textarea
    size: large

sidebar:
  images:
    type: files
    headline: Afbeeldingen
    template: image

I also have a files/image.yml blueprint:

title: Image

fields:
  alt:
    label: Alt Text
    type: text

(and a files/default.yml which is the same)

However, when I look at a project page in the panel, I don’t see any images. What am I doing wrong?

You are not doing anything wrong, but your original images do not have a template assigned to them, so they won’t show up if you set template: image.

You can do one of two things:

  1. Remove the template
  2. Update all files metadata with the template field set to image. This can be done with the $file->update() method.

The template is stored in the metadata file as template: image when you upload a file in a section with a defined template property. If no template is defined, no template is stored.

Ah, thank you for the quick reply! This issue originally appeared when I did not have a files/image.yml template. When I delete it (and the default one as well), I still don’t see any images on the project page.

Or am I reading your reply wrong and am I deleting the wrong template?

I wasn’t talking about deleting the template, but the property from the section definition:

sidebar:
  images:
    type: files
    headline: Afbeeldingen
    #template: image # <= bye-bye

Ah yep, this solves the issue. Thanks so much!