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 »

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: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Can't run cylinderize command in php

Post by Bonzo »

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: 25562
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 »

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 »

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 »

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: 12159
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 »

"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 »

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