PHP exec command in wappler?

PHP has a command called: exec
This command will allow PHP to execute commands that would normally be done on the command line. I’ve got a project that wants to compress an uploaded PDF file using Ghostscript. The user will upload a larger PDF and once in the portal they can click a button to have the file compressed. Right now, the only way I see to do this is with a cron job. The thing is, the client doesn’t upload a ton of files and they are at random times during the month. Using cron would leave a lot of waiting time for the client after a PDF has been uploaded. I suppose another option would be to use the API step in Server Connect to open a PHP file on the local server, seems silly to access PHP this way on a local machine.

So my question is: what’s the best way to execute the following in Wappler with a PHP setup?

gs -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=306 -dDEVICEHEIGHTPOINTS=396 -dFIXMEDIA -dPDFFitPage -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=NewClientPDF.pdf UploadedClientPDF.pdf

Community Page
Last updated: