I have the following idea and would like to ask for the right way to do:
In a directory in the NC share I save photos from the mobile phone. Now I want to run a small (Python-) script on the NC server, which scales the image down using imagemagick. Then I can use it for mail attachments and so on.
Two questions arise:
When is the upload of the image complete? Can my script get a trigger from NC for this?
It is not sufficient that the new image exists in the file system. How do I get the new image automatically into the NC share (register the file in the NC-database)?
Do we have to develop a real plug-in? Or is there already a solution for the idea?
thank you very much for this hint. It seems to be the right solution for my request and I will soon start to experiment!
To explain the second question:
If a new file is created in nextclout/data/user/files (by hand or by running a script) on the NC server, it is not automatically being presented in NC’s webfrontend or to any dav-client. Imho, it needs to be registered in the database. So, how can that be done?
But eventually, the workflow app will do it…
My sgesstion is to added some local folder as Nextcloud external storage and work with your scripts direct there. Afterwards ether run rescan command, or do periodical external shares rescan. I wrote small script for a cron job, to do periodically external shares rescan. Will also generate small report in your logs: