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-25T08:01:43+00: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-20T15:08:19+00: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-03T00:14:51+00: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-25T08:01:43+00:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 »

Bonzo wrote: 2018-03-25T14:14:25+00: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-25T08:01:43+00:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 »

fmw42 wrote: 2018-03-25T18:41:09+00: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-24T06:01:33+00: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-25T08:01:43+00:00
Authentication code: 1152

Re: Can't run cylinderize command in php

Post by Roshit121 »

snibgo wrote: 2018-03-26T10:02:05+00: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