When using file template, how to detect images already in folder

Hello, hope everyone is having a nice day. I have a problem with a “files” section where a template is designated, such as image.yml from the starterkit. If there is no template set, the panel detects the files already in the folder, which is what I want. However, if I do set a template, the panel doesn’t find the files.

Is this because there isn’t a text file for each image already? It works properly if I remove all the images from the content folder, and then import them again from the panel, but this isn’t ideal to me.

Hm, you could add a metadata file together with the file you upload outside of the Panel. You can’t mix different file templates in a single files section (as there is no way to set a template on upload), so that means you can’t mix template and no-template either.

I currently have no idea how you could trigger this programmatically to add a meta data file to manually uploaded files :thinking:.

Thanks for the reply. It’s not such a big deal to remove them and add again, and it’s better to have the a text file for each image ready to go anyway.

Now that I think about it, I think I ran into problems in kirby 2 for this reason. In kirby 2, if there was a default value set for image metadata for instance, it wouldn’t get read (or rather wouldn’t exist) until you “saved” the image in the panel.

Why are you running into this problem? Is that a project that you convert from K2 to K3, or is that just something you run into during the development phase; or are these files uploaded from the frontend?

I just hit this problem. I’m about to do a new website for an old client / brand of mine which has changed owners and is getting rewhamped. More for nostalgia than the budget. But one task is them having 9666 images across 245 galleries neatly arranged in folders “event-title_31-12-2001” so I manually renamed all of them “20011231_event-title” as I thought I remembered that you could basically just throw files and folder like that at Kirby. Luckily the panel is a breeze to work in :tornado::flushed:

You can run through all files and do a $file->update() to create a meta file with the template.