开发者

Objective-C/CGI my only option?

开发者 https://www.devze.com 2023-03-25 17:58 出处:网络
I need to create a web-service which invokes applescript which in turn starts photoshop, does some processing on an image, saves the images to disk and returns the image.

I need to create a web-service which invokes applescript which in turn starts photoshop, does some processing on an image, saves the images to disk and returns the image.

Now, I have never done server side programming before and so I am a bit confused about how I should do this. I know there's something called CGI which will allow me to write the service in C (also Objective-C) and I can simply execute the c executable. But I want to know if this is my only options here or there are better options?

I will also need to send a base64 encoded st开发者_C百科ring representation of an image to this web-service (two of them actually).

Thanks for your help.


As Amanda said you can use a lot of CGI languages like Python or Ruby to do this. Look at Appscript. I used to have several scripts run this way although I got rid of them. It's really quite easy. I have tons of appscript Python examples at my blog if you need some examples. If you aren't sure how to run CGI scripts with Python check out this tutorial. I used to have a short (3 page) Python CGI script that ran a full blog with comments before I finally switched to WordPress.


You can easily call an executable from PHP itself if your server is running Apache and PHP ... you really wouldn't have to go through another scripting language like Ruby, CGI-scripts, etc.

Depending on your needs, you may also want to look into the OSX's launchd service. It can handle a lot of automation tasks including watch folders, file-events, etc. So in that case, you may not even need to trigger the service from a script, but rather simply copy a file into a folder, or create a file-based semaphore in the file-system (i.e., the script would launch with the presece of some specifically created file, so rather than calling an executable, all your web-script has to-do is just create and delete a file somewhere).

0

精彩评论

暂无评论...
验证码 换一张
取 消