Generate meta-data for image automatically (like Modified-Date, filename, etc.)?

Hello, I would like to update the meta-information of my uploaded images automatically without having to fill in the data in the Panel.

Let’s say test-image.jpg was last time modified 25/03/2015, 15:18. Can I get its timestamp like file()->modified(), convert it to a time (with date(“d/m/Y, H:i”, $timestamp)) and fill it into the test-image.jpg.txt automatically?

Thanks!

Why do you want to store this in the image metadata file?
If you don´t want to write the code to convert the timestamp into text every time, you can create a plugin for it.
Or do you want to have some exif information from the image, like the creation timestamp?

I don´t understand what information you want to have.

Basically, I need to know, when the image was taken. Does every image provide a exif-information? So, yes, I forgot about the exif stuff. Does every image provide that?

How could I get the creation timestamp into the meta.txt?

Thanks!

I wonder why you would write it to the metadata file?
Isn´t it enough to get it “live” from the file? See http://getkirby.com/docs/cheatsheet#exif for the documentation of the exif data functions.

Every camera I know adds a creation timestamp to every image. It can be lost if you edit an image, but most of the software should preserve the meta information. Simply try it.

But to your original question: I don´t know how to save some text to the images meta file in a simple way. There is no standard way to achieve this and I thinks that it is not necessary to write information to this file that you would get from the image as well. But this is my opinion.

I ran across something similar today. But it was just because there was no exif data available in the .jpg.

I tried to try & catch the error, but there was no way to handle the error.
would a manual .jpg.txt help?
If the image containts exif, it’s just fine to extract them with the Kirby functions. But if there is no exif available, scripts keep crashing.

Okay, indeed, I was thinking some steps too complicated, instead of just fetching the data from the file directly… But thanks for that!