# Files (images) not appearing in panel after importing content from older installation

**URL:** <https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306>\
**Category:** Questions\
**Tags:** v4\
**Created:** [April 5, 2024, 7:47am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306 "2024-04-05T07:47:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 5, 2024, 7:47am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/1 "2024-04-05T07:47:28Z")

</div>

I have a very old installation of a Kirby 2 powered website that I’m (finally!) updating. I want to do a redesign of the website at the same time, so to start with I am trying to import the old content into the Kirby Starterkit and I’ll take it further from there.

I’ve managed to successfully import pages (I still have to get the panel fields right but I think I can manage that), but the images I imported are not appearing in the panel.

This is the the panel home page (site page):

 ![Screenshot 2024-04-05 at 09.38.22](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/7/74730bd771a12a85f18e00396d4768e8404b6cc1.jpeg)

This is the panel page for a news post, where under files it says there are no files yet:

 ![Screenshot 2024-04-05 at 09.38.37](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/1/17f93bbb7c47fc47332b21b9cce0cf86a18d6898.jpeg)

This is the folder structure:

 ![Screenshot 2024-04-05 at 09.38.54](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/a/a22f3e5e99e48f7fd622c27128a966d3d653b03a.jpeg)

These are the file permissions (files are 644):

 ![Screenshot 2024-04-05 at 09.41.05](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/23374260e95560c6dae722acb3c11d67a91e345c.jpeg)

This is what the post looks like on the website (the file shows up):

 ![Screenshot 2024-04-05 at 09.42.35](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/a/a91062e6e23409c03f674aef2807722ad4bbd9eb.jpeg)

Does anybody know what I might be doing wrong? Thanks!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 5, 2024, 8:36am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/2 "2024-04-05T08:36:31Z")

</div>

Could you please post the blueprint for that page?

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 5, 2024, 8:47am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/3 "2024-04-05T08:47:27Z")

</div>

Of course. The blueprint for the page is this (as you can see I have changed very little from the Starterkit note template):

```auto
# Each page blueprint must have a title, the title may be different from the file name
title: Article

# Sorting number scheme that is applied when page status is changed to `listed`
# More about page sorting: https://getkirby.com/docs/reference/panel/blueprints/page#sorting
num: date

# Each page can have an icon that is shown in page listings when no preview image is available.
icon: 📖

# Custom descriptions for each page status depending on use case
# More about page status: https://getkirby.com/docs/reference/panel/blueprints/page#statuses
status:
  draft:
    label: Draft
    text: The note is still in draft mode. It can only be seen by editors with panel access.
  unlisted:
    label: In Review
    text: The note is online and can be visited with the direct URL. The team must still give the final go to publish it.
  listed:
    label: Published
    text: The note is online and listed in the blog

# Define the form layout with two columns
# Columns are optional but help structure the form layout
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
columns:
  - width: 2/3
    # This columns only has a single field
    fields:
      text:
        type: blocks

  - width: 1/3
    # This second column holds a fields section with multiple fields
    # More about fields sections: https://getkirby.com/docs/reference/panel/sections/fields
    sections:
      meta:
        type: fields
        fields:
          # If you need the same field in multiple locations, you can define them once and reuse whereever needed.
          # Here we use a files field defined in `/site/blueprints/field/cover.yml`
          cover: fields/cover
          date:
            type: date
            time: true
            default: now
          author:
            type: users
          # Fields types can be added using the shortcut `fieldname: true`
          # (however, you can only use a fieldname once per page and this only makes sense for simple fields without configuration)
          tags: true
      files:
        type: files
        template: blocks/image

```

I haven’t changed the `blocks/image.yml` blueprint or the `files/image.yml` blueprint from the Starterkit.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 5, 2024, 8:51am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/4 "2024-04-05T08:51:43Z")

</div>

> [@flobin](#):
>
> ` template: blocks/image`

This template is very likely not assigned to your imported images, that would explain why they are not showing up.

Either remove the template property, or assign this template manually or programmatically to your images.

`template` is a filter that allows you to have files in different files sections if needed. If you don’t need the filter, remove it.

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 5, 2024, 9:38am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/5 "2024-04-05T09:38:13Z")

</div>

Thank you! I am trying to write a script to assign the template to the images, but I’m not having much luck.

Is there a page in the docs that has information about how to do things like this?

What I’ve tried is this, which I called `assignfiletemplates.php`:

```auto
<?php

// Load Kirby
require_once 'kirby/bootstrap.php';

$kirby = new Kirby();

$kirby->impersonate('kirby');

$images = $kirby->$site()->$index()->files()->images();

try {
    foreach ($images() as $image) {
        if(!$image->template()) {
          $image->update([
            'template' => 'image'
          ]);
          echo "Template 'image' assigned to: " . $image->filename() . "\n";
        }
    }

} catch (Exception $e) {
    echo "Failed to assign template. Error: " . $e->getMessage() . "\n";
}

```

This is the error message I get:

```auto
Whoops\Exception\ErrorException: Undefined variable $site in /Users/robin/Library/CloudStorage/Dropbox/DAVL/website/assignfiletemplates.php:10
Stack trace:
#0 /Users/robin/Library/CloudStorage/Dropbox/DAVL/website/assignfiletemplates.php(10): Whoops\Run->handleError(2, 'Undefined varia...', '/Users/robin/Li...', 10)
#1 {main}
Whoops\Exception\ErrorException: Undefined variable $site in file /Users/robin/Library/CloudStorage/Dropbox/DAVL/website/assignfiletemplates.php on line 10
Stack trace:
  1. Whoops\Exception\ErrorException->() /Users/robin/Library/CloudStorage/Dropbox/DAVL/website/assignfiletemplates.php:10
  2. Whoops\Run->handleError() /Users/robin/Library/CloudStorage/Dropbox/DAVL/website/assignfiletemplates.php:10

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 5, 2024, 9:46am UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/6 "2024-04-05T09:46:15Z")

</div>

> [@flobin](#):
>
> `$images = $kirby->$site()->$index()->files()->images();`

This cannot possibly work.

```auto
$images = $kirby->site()->index()->images();

```

> [@flobin](#):
>
> ` 'template' => 'image'`

In your blueprint, you use `blocks/image`, so either change that in your blueprint or change it to `blocks/image` here.

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 5, 2024, 12:37pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/7 "2024-04-05T12:37:28Z")

</div>

Thank you! This solved the problem.

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 5, 2024, 2:44pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/8 "2024-04-05T14:44:42Z")

</div>

Just a question, which I think is related. Since I imported these files from an old Kirby installation, none of them have UUIDs. I can’t seem to figure it out from the docs: is there a way to assign UUIDs to files somehow?

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [April 9, 2024, 2:26pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/9 "2024-04-09T14:26:20Z")

</div>

Sorry to bother again, I thought the issue was solved, but I am actually still encountering the problem with missing images. Ping @texnixe, I hope that’s okay.

I’ve managed to assign UUIDs and the correct template to all the image files.

The images show up in the panel on the site page:

 ![Screenshot 2024-04-09 at 16.21.12](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/c/c26dc88d666ea590dda3bd676ff777e3e1516684.jpeg)

However the images do not show up in the panel on the article page:

 ![Screenshot 2024-04-09 at 16.21.18](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/26a3962e7b4ad87e601d083b7ee74205c601b2a0.jpeg)

They do get loaded in the template, though:

 ![Screenshot 2024-04-09 at 16.21.23](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/a/a761211a87dccbfa7dccfc60021bf96884683a46.jpeg)

This is the folder structure (and image metadata):

 ![Screenshot 2024-04-09 at 16.25.12](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/b/be0d84bece1026bb496e50f9205afeb572b1d022.jpeg)

This is the article blueprint, `article.yml`:

```auto
# Each page blueprint must have a title, the title may be different from the file name
title: Article

# Sorting number scheme that is applied when page status is changed to `listed`
# More about page sorting: https://getkirby.com/docs/reference/panel/blueprints/page#sorting
num: date

# Each page can have an icon that is shown in page listings when no preview image is available.
icon: 📄

# Custom descriptions for each page status depending on use case
# More about page status: https://getkirby.com/docs/reference/panel/blueprints/page#statuses
status:
  draft:
    label: Concept
    text: Het artikel is een concept en nog niet gepubliceerd. Het kan alleen worden gezien in het panel.
  listed:
    label: Gepubliceerd
    text: Het artikel staat op de website en kan worden gezien door bezoekers.

# Define the form layout with two columns
# Columns are optional but help structure the form layout
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
columns:
  - width: 1/3
    # This column only has a single field
    fields:
      text:
        type: writer
        label: Tekst

  - width: 1/3
    fields:
      images:
        type: files
        template: blocks/image
        label: Afbeeldingen

  - width: 1/3
    # This second column holds a fields section with multiple fields
    # More about fields sections: https://getkirby.com/docs/reference/panel/sections/fields
    sections:
      meta:
        type: fields
        fields:
          date:
            type: date
            time: true
            default: now
            label: Datum
          # Fields types can be added using the shortcut `fieldname: true`
          # (however, you can only use a fieldname once per page and this only makes sense for simple fields without configuration)
          tags: true

```

This is the image blueprint, `image.yml`:

```auto
# Each file blueprint must have a title, the title may be different from the file name
title: Image

# Like page blueprints, file blueprints can define a layout with tabs, columns, sections and fields
# File blueprints define what sort of information should get stored in a file's meta data file
# In addition to the fields defined in this example blueprint, you can also set what type of file is acceptable
# when this blueprint is used, which allows you to control what users can upload.
# More about file blueprints: https://getkirby.com/docs/reference/panel/blueprints/file

accept: 
  type: image

columns:
  - width: 1/2
    sections:
      content:
        type: fields
        fields:
          caption:
            label: Opschrift
            type: textarea
            size: medium
  - width: 1/2
    sections:
      meta:
        type: fields
        fields:
          alt:
            label: Alt text (beschrijving van de afbeelding) 
            type: text

```

`blocks/image.yml` just extends `files/image`.

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [January 30, 2025, 3:34pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/10 "2025-01-30T15:34:51Z")

</div>

Hi, sorry to bump this. I’ve continued work on this website and am nearing the launch. (Yes, it took a long time because it all happened after work and on weekends.)

Strangely, now the projects on the homepage do not show image previews:

 ![Screenshot 2025-01-30 at 14.25.17](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/9/9c09d4b2ea03b98a779fe5081115db72f8c9ede5.png)

But on the other hand, on a project page and on a news article page, the images are recognized:

 ![Screenshot 2025-01-30 at 16.32.20](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/b/b2ad0106592573db9cd58bce9be0ea4c18dbb8cb.jpeg)

(I have not changed the blueprints for the article or project.)

Does anybody know why this might happen?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 30, 2025, 10:35pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/11 "2025-01-30T22:35:23Z")

</div>

As a first step I’d clear the media folder and the browser cache.

Then it would be interesting to see your site blueprint, i.e., what files are queried in those pages sections.

---

<div class="post-metadata">

**Author:** ![flobin](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@flobin](https://forum.getkirby.com/u/flobin)\
**Post date:** [February 3, 2025, 1:51pm UTC](https://forum.getkirby.com/t/files-images-not-appearing-in-panel-after-importing-content-from-older-installation/31306/12 "2025-02-03T13:51:00Z")

</div>

So the problem was with the blueprints, they were not querying the images correctly. I kept looking at `blueprints/pages/project.yml` and `blueprints/pages/article.yml`, but the culprits were `blueprints/sections/projects.yml` and `blueprints/sections/news.yml`.

These blueprints were trying to query `page.cover` for the image, but I had deleted the ‘cover image’ from the Kirby Starterkit. Well, not quite entirely, as it turns out. So now I’m just querying `page.images.first`. This solved the issue.

Thank you for your patience and help!
