I have a JAR that is a simple command line program/utility that converts an image file to another image format. I need to integrate this into a website where users upload image files and the files are converted to another image format. All the pages for the site are written in PHP and all image files are stored on the file system (not in a database). What is the recommended approach to integrate this JAR into the website - by calling a JSP from a PHP page or by calling the JAR directly from PHP...or another recommended way to integrate the JAR into the website?
Ideally, I would like to have the JAR called (with the required parameters) to convert each image file as soon as it has finished uploading.
I was planning on creating a script that would be called by a CRON job to scan for new/changed files or folders and for the conversion utility to run on those files or folders, but this doesn't provide the desired user experience. We'd like to minimize the time between when an image is uploaded to when it is converted to another image format. Thanks in advance.
Bear, I like the recommendation. Though if I go down this route, should I design the webservice to only require a parameter of the file path of the image file to convert (since the file will be uploaded to the server and I want the WebService to perform the conversion on the files that reside on the server)? Or would you recommend that the PHP passes the image file to be uploaded to the WebService and the WebService handles the process to upload the image file and then the conversion.
Any recommendations on designing a WebService that performs file I/O on the hosting server would be appreciated. Thanks.
subject: Calling a JAR file from JSP or from a PHP page or another option?