Panel: How to show date, when file was uploaded?

Good Moring!

One of the new things I’ve seen at the workshop in Berlin, was the ability to modify informations shown in the panel. :smiley: That is (like most of Kirby) new to me.

So I tried this in my Blueprint:

    title: Fotografien
    sections:
      gallery:
        type: files
        layout: cards
        info: "{{ file.niceSize }} - {{ file.dimensions }} - {{file.modified}}"
        image:
          cover: true
          ratio: 1/1

The “info”-section I’ve seen at the workshop. The first two infos I’ve seen there, the third I’ve found here: https://getkirby.com/docs/reference/tools/f/modified - I guess, I’m on the wrong way.

I would like to have the date, when I uploaded an image to my webspace (not when it was taken).

BTẂ: Is it possible to insert line-brakes to that information on the cards?

Thank you in advance!

Dennis

1 Like

$file->modified() should actually show the date the file was uploaded?

You could add a line break (<br>), but I don’t know how that works out in list layout.

Oh, the <br> works. I haven’t tried HTML in YAML. :innocent:

Yes, it shows “1571592264” for example and I tried to make it human-readable. As on writing and trying i found my solution:

{{ file.modified('d.m.Y') }}

Thank you, Sonja! :smiley:

I don’t get the difference between https://getkirby.com/docs/reference/objects/file/modified and https://getkirby.com/docs/reference/tools/f - is there any?

The F class provides basic file handling stuff. Methods from this class are used within the File class.

Note that if you do something with your file, like rename it in the Panel etc., the modification time will change.

If you really only want the upload timestamp and make sure that this date is not modified by the file system if you move stuff around, I’d store the date in the meta data on upload using a hook.

Yes, seen that a second ago.

:crazy_face: Let me learn the basic-stuff first. But I’ll keep a bookmark on that, Sonja. :smiley: