Page 1 of 1
Can't run cylinderize command in php
Posted: 2018-03-25T06:29:26-07:00
by Roshit121
Hi,
I successfully ran the cylinderize script in Cygwin, but when I tried to run it using php, it did not give the output image.
I tried it using the following code:
Code: Select all
<?php
shell_exec('/cygdrive/c/cygwin64/bin/cylinderize.sh -m vertical -r 370 -l 810 -w 85 -p 5 -e 2 -a -90 -v background -b none -f none -o -100-65 -c multiply image.png mug.png wrap1.png');
?>
Re: Can't run cylinderize command in php
Posted: 2018-03-25T07:14:25-07:00
by Bonzo
Have you changed the permissions for cylinderize.sh?
I used to use 777 but 755 may work.
Also try changing ' ' to " "
Re: Can't run cylinderize command in php
Posted: 2018-03-25T11:41:09-07:00
by fmw42
Try the following and see what error messages you get:
Code: Select all
<?php
exec("bash /cygdrive/c/cygwin64/bin/cylinderize.sh -m vertical -r 370 -l 810 -w 85 -p 5 -e 2 -a -90 -v background -b none -f none -o -100-65 -c multiply image.png mug.png wrap1.png 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
If that works, you can try removing the bash at the beginning.
Re: Can't run cylinderize command in php
Posted: 2018-03-25T22:48:59-07:00
by Roshit121
Bonzo wrote: ↑2018-03-25T07:14:25-07:00
Have you changed the permissions for cylinderize.sh?
I used to use 777 but 755 may work.
Also try changing ' ' to " "
The permission for cylinderize.sh is 755 and changing ' ' to " " didn't seem to work
Re: Can't run cylinderize command in php
Posted: 2018-03-25T22:51:46-07:00
by Roshit121
fmw42 wrote: ↑2018-03-25T11:41:09-07:00
Try the following and see what error messages you get:
Code: Select all
<?php
exec("bash /cygdrive/c/cygwin64/bin/cylinderize.sh -m vertical -r 370 -l 810 -w 85 -p 5 -e 2 -a -90 -v background -b none -f none -o -100-65 -c multiply image.png mug.png wrap1.png 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
If that works, you can try removing the bash at the beginning.
The code gave me the following errors:
Invalid Parameter - configure
Invalid Parameter - image.png
and removing the bash gave me the following error:
The system cannot find the path specified.
Re: Can't run cylinderize command in php
Posted: 2018-03-26T03:02:05-07:00
by snibgo
"Invalid Parameter" isn't a message that IM produces. It can be produced for the Microsoft Windows program convert.exe, that modifies disk drives.
I suggest you ensure that IM's directory is at the front of PATH, and that PHP sees the same path.
Re: Can't run cylinderize command in php
Posted: 2018-03-26T08:00:26-07:00
by Roshit121
snibgo wrote: ↑2018-03-26T03:02:05-07:00
"Invalid Parameter" isn't a message that IM produces. It can be produced for the Microsoft Windows program convert.exe, that modifies disk drives.
I suggest you ensure that IM's directory is at the front of PATH, and that PHP sees the same path.
The code seems to run after I added full paths to image and cygwin bash
Code: Select all
<?php
C:\cygwin64\bin\bash.exe --login -c '/cygdrive/c/cygwin64/bin/cylinderize.sh -m vertical -r 370 -l 810 -w 85 -p 5 -e 2 -a -90 -v background -b none -f none -o -100-65 -c multiply C:/xampp/htdocs/test/image.png C:/xampp/htdocs/test/mug.png C:/xampp/htdocs/test/wrap1.png'
?>