Images uploaded via ftp: how to show them in panel

Hello,
I have spent a few days with Kirby 3 and it looks great.
And questions are popping out :slight_smile:

The docs say it is possible to upload files manually and then show them in the panel. Well… It doesn’t say how.

I have a news section, with article.yml. I have defined files section (with files/image.yml blueprint) so I can upload images on the panel. I have files field for cover image and gallery for choosing the images.

But I would love to upload images with ftp and then display them in whatever files section/field is it possible? Even Kirby 3 starter pack Magazine doesn’t work this way.

article code:

    sections:      
      one:
        type: fields
        fields:
          coverimage:
            type: files
            layout: cards
            template: image
            min: 1
            max: 1
            multiple: false
      gallery:
        type: files
        layout: list
        template: image
        query: parent

Does query needs to be set somehow to detect files located in the folder?

Thanks

If you do FTP images, they need go in the respective content folder for the page you want them to belong to. For example, if had an about page i would FTP them to:

public/content/1_about

Your webroot might be called something else like public_html or www or htdocs… depending on what your webhost decided to call it. If you have that page open in the panel when you FTP them, the images wont show up until you reload the page.

However, I would suggest using the panel to upload the images, a files section (this is different to a files field) which will allow you to upload through the panel. The reason I suggest this is because the panel catches and corrects bad file names and converts to a format that will work fine on the internet. For example, spaces in filenames are bad and certain characters will cause issues on some sites.

You also wont be able to use certain hooks to process the file. For example, if the image is above a certain size, you can get Kirby to downsize it to something sensible. This is good for clients who have habit of uploading 6,000 px wide images straight from a camera.

It’s up to you of course. Note that in your example above your using the query option to list images from the page that is the parent of this page. Unless you intend to store all your images in /news rather then for each article sub page, then take the query line out.

edit: im having another look at your blueprint code now you have fixed the code formatting in the post

Two problems with this code:

  • you are querying the parent, but this should probably be query: page.files to query the files of the current page.

  • Secondly, you are limiting your files to the image template, but files uploaded through FTP won’t have a template assigned to them. The template is assigned if you upload files through a files section, and they get the template assigned to them in that files section.

So you can select images uploaded via FTP, but you have to adapt your options.

The rest has been been said by @jimbobrjames

Thank You both for the quick answer.

I agree with @jimbobrjames that using panel make more sense. However, I would like to make this working. And it is not. I have corrected the blueprint like this (/site/pages/article):

 sections:
   cover:
     type: fields
     fields:
       coverimage:
         type: files    
   gallery:
     type: files
     #template: image
     #query: page.files

My folder structure is:

**public**/content/news/article1/…

files go there.

Although I have refreshed the page etc., the ftp uploaded files won’t show up.
I have tried different browser as well.

The blue prints should go in /site/pages/blueprints/. Is the article.yml file in the correct place?

Yes, the blueprint article.yml is in that folder… an is working correctly.
I can see all the adjustments I am making. I can’t say that about the ftp uploaded files :-/

@jimbobrjames I think you mean site/blueprints/pages/.

@lexislav Does it work when using a blueprint with preset: page?

# site/blueprints/pages/default.yml

title: Default
preset: page

I just tried it on a fresh installation and it works flawlessly.

Whoops! yes i did… not quite enough coffee…

Thanks, @thguenther

preset: Page

did the trick. Now it works! Thanks!

edit: Now I see another reason it didn’t work: Some of files were out of camera jpgs with names starting with underscore (a lot of cameras does that). Another reason the files were not showing in the panel. Thanks for patience.

Yes, uploading via the panel would have corrected those filenames during the upload.