Page 1 of 1
Command wich work in DOS prompt but not in PHP
Posted: 2012-08-28T02:04:31-07:00
by adil@alfasoft.ro
The command
convert "page0006.tif" -background black -deskew 40% +repage -threshold 75%,80% -write mpr:image +delete ( mpr:image -crop 2020x200+0+1346 -scale 2020x1! -bordercolor black -border 1 -trim -write info: ) ( mpr:image -crop 200x2892+910+0 -scale 1x2892! -bordercolor black -border 1 -trim -write info: ) null:
Is working very well in Dos prompt, but same command don't work in PHP with exec (don't return the info:)
Thanks in advance.
Re: Command wich work in DOS prompt but not in PHP
Posted: 2012-08-28T02:42:19-07:00
by whugemann
As far as I remember this problem has been discussed several times over here. It's probably that the PHP script is executed as a different user than you are usually logged on, probably under administrator rights. So you should test your code while being logged on as the administrator and see whether you run into the same problem. A workaround could be that you supply the full path to Convert, i.e. "%PROGRAMFILES%\ImageMagick...\convert.exe" instead of just calling Convert.
Re: Command wich work in DOS prompt but not in PHP
Posted: 2012-08-28T02:45:18-07:00
by adil@alfasoft.ro
It seems that the command is executed but the response is not coming. Same situation on Linux.
Re: Command wich work in DOS prompt but not in PHP
Posted: 2012-08-28T09:59:35-07:00
by fmw42
try adding 2>&1 after the null:
You may also have to put the full path to convert
Re: Command wich work in DOS prompt but not in PHP
Posted: 2012-08-29T04:05:13-07:00
by adil@alfasoft.ro
Thank you guys but is same situation. Any suggestions?
Re: Command wich work in DOS prompt but not in PHP
Posted: 2012-08-29T08:37:39-07:00
by whugemann
Rather often, IM writes textual output to
stderr rather than
stdout, see
http://www.imagemagick.org/Usage/windows/#pitfalls. Fred basically suggests to redirect this output. However, the output of info: is treated no other than other output "images", i.e. it is written to
stdout.
If I were you, I would try a simpler command with info: output in PHP, in order to narrow the cause of the error.