I have a use case which I haven’t found anyone else posted about online yet, where I’d like to run imagemagick convert-command based on a automated tag when a file is uploaded.
User uploads image.jpg
Flow Automated Tagging ensures that image.jpg is tagged image
Flow with External Scripts-app runs command convert image.jpg -resize 1000x1000/> on all files that is tagged image
As I’ve found elsewhere in the forum it seems like php-imagemagick have been disabled out of security reasons, which is perfectly fine. In my case the server will be local and only utilized by trusted users, so the security concern is not relevant in my case - but if we can keep the instance secured that’s definately preferred.
Is there any alternative software that can be used to run a similar command? Is there any workaround to call a bash script outside of NC to execute it only server-side? Any examples of how to implement this?
Any help and/or guidance would be greatly appreciated
Thanks for your feedback. I’ve been trying to wrap my head around this now for a while, but can’t seem to get it sorted. The problem is that I find the logging really hard to interpret even though I’ve enabled debugging.
The command I’m trying to run is the following and I’ve verified that the www-data user is able to run this in any folder applicable. It works excellent server-side: sudo -u www-data /usr/bin/convert <path/to/file> -interlace plane -strip -quality 80 -resize 1000x1000\> -set filename:new '%t_1' ../%[filename:new].jpg
When I then try to run this via the workflow script, the logging give me feedback that it was successful to run the command which in the GUI looks like this: /usr/bin/convert /mnt/product-images-sync/%n -interlace plane -strip -quality 80 -resize 1000x1000\> -set filename:new '%t_1' ../%[filename:new].jpg
Unfortunately nothing happens at this point, even though the log output for %n and the static set path definately matches the full working path for the file itself. I then tried to convert this line to a bash script to get workflow log output as suggested by you from other threads in relating matters, but have been unsuccessful at that part too.
Ok, so I managed to get workflow script log output and it seems like the path provided isn’t correct, but naturally also adds the /<user>/<folder>/ in the beginning, which isn’t applicable to me since I’m using a locally mounted folder (via external storage).
Now I’m trying to manage to remove that part from the variable…
Ok, so I managed to get workflow script log output and it seems like the path provided isn’t correct, but naturally also adds the /// in the beginning, which isn’t applicable to me since I’m using a locally mounted folder (via external storage).
I think your assumption is wrong, because Nextcloud always uses this structure to access user specific files. As written in the app documentation you need to prefix the path with the Nextcloud data path to access any files in the Nextcloud environment, like “<nextcloud-data-path>/<user>/files/<the-relevant-directory-from-the-Nextcloud-user-root>”