执行php命令后台窗口

I am developing a desktop based php application where I need to print the image of a person in Floyd-Steinberg format. I capture the image in RGB format and convert the image to Floyd-Steinberg dithering image. I am using the ImageMagick to convert the RGB image to dithering image where I pass the commands in my windows cmd prompt so the image is converted and saved. I want to execute that command in my main application so when I click the image and give the print given command should automatically take that image from database and convert that image and it should be printed in a dithering format .I am using the javascript to pass all these data to print the data through zebra printer.Normally I tried to convert the image to dithering image but I am not able to convert the image to grf image(NOTE: There should not display any prompt while printing the image when I click the print button).

So is there any method that I can embed the ImageMagick application into my application and pass the command to print the image

Your in luck I just happen to have a class you may find interesting

https://github.com/ArtisticPhoenix/MISC/blob/master/BgProcess.php

It is capable of doing a background command in both windows and linux ( automatically )

The relevant windows code is this:

    $WshShell = new \COM('WScript.Shell');
    $cmd = 'cmd /C '.$phpPath.' '.$script;
    $oExec = $WshShell->Run($cmd, 0, false);

Where $phpPath is the path to the php.exe application file, and $script is the command. The above class wraps this and the linux background put & at the end into a friendly interface.

PS the windows code took a bit to work out ... :)

The class is very easy to use for example:

  new BgProcess('path to php file to run', 'arg1', 'arg2' ...);

And that is it. Because this is a shell command all the "args" should be strings.

You may also find these useful

https://github.com/ArtisticPhoenix/MISC/blob/master/ProcLock.php single process locking, ie mutex for php.

https://github.com/ArtisticPhoenix/Cli Command line argument manager, Which is also on composer.

cheers.