Quoting Vu The Cuong <vuthecu...@luvina.net>:

> The subject says it all. Currently I'm considering to
> develop web-based (PHP) image editing application with gimp as backend
> engine for intranet use.

I responded to your post on GIMPtalk but thought I'd echo it here for  
posterity's sake...

You will need to start the GIMP's Script-fu server plug-in and then  
have your PHP program talk to the server over a TCP port. Script-fu  
commands are sent over the TCP port prefixed by "Gxy" where x and y  
together specify the length of the command in bigEndian-style.

Here is a quick run-through (for GNU/Linux using BASH):

    1. As root, create a file /dev/tcp/
    2. As root, chmod the mode of that file to 666
    3. start the GIMP in the background with the server plug-in being  
the only interface:
             gimp -i -b '(plug-in-script-fu-server 1 10008  
"/home/cuongvt/script-fu-server.log")' &
    4. To monitor the activity, run
             tail -f /home/cuongvt/script-fu-server.log (you will need  
to wait a while for GIMP to start up)
    5. From another shell, type the following:
             echo -e "G\0000\0015(gimp-quit 0)" >/dev/tcp/

(The '\0000\0015' part is the string length of "(gimp-quit 0)" as  
characters specified in octal.)

You should see messages similar to the following appear in the log file:

       Server: connect from host, port XXXXX.
       Received request #0 from IP address (gimp-quit 0) on  
Thu Dec 11 16:44:57 2008
       ,[Request queue length: 1]Processing request #0

Of course, you will want to use a PHP client (instead of "echo") and  
to have it count the string lengths and provide the proper prefix  
automatically. Also, I don't use PHP and don't know how it sends and  
receives data over a TCP port.

Gimp-user mailing list

Reply via email to