Can't run cylinderize command in php

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
Roshit121
Posts: 7
Joined: 2018-03-25T01:01:43-07:00
Authentication code: 1152

Can't run cylinderize command in php

Post by Roshit121 » 2018-03-25T06:29:26-07:00

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');
?>

Bonzo
Posts: 2963
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Can't run cylinderize command in php

Post by Bonzo » 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 " "

User avatar
fmw42
Posts: 23668
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't run cylinderize command in php

Post by fmw42 » 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.

Roshit121
Posts: 7
Joined: 2018-03-25T01:01:43-07:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 » 2018-03-25T22:48:59-07:00

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

Roshit121
Posts: 7
Joined: 2018-03-25T01:01:43-07:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 » 2018-03-25T22:51:46-07:00

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.

snibgo
Posts: 10563
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't run cylinderize command in php

Post by snibgo » 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.
snibgo's IM pages: im.snibgo.com

Roshit121
Posts: 7
Joined: 2018-03-25T01:01:43-07:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 » 2018-03-26T08:00:26-07:00

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'
?>

Post Reply