Page 1 of 1

Wired problem to run Fred's Scripts in PHP

Posted: 2014-09-23T08:26:39-07:00
by HankWolfe
I'm trying to run Fred's Scripts in PHP using exec. It works correctly for text in short length. However when the text becomes longer, the result is not correct.

Here is the PHP code and the $output is always empty, no error message.

Code: Select all

exec($cmd,$output);
print_r($output);
Here is the $cmd to run. This is short text.

Code: Select all

$cmd = "bash ~/etc/texteffect -t '1 long text 2 long text 3 long text' -s plain -e arc-top -a 180 -f font/foo.ttf -p 50 -c black -b none -l 1 -u none output.png";
The result is correct. See this image:
Image

Now let's try longer text. Here is the $cmd to run.

Code: Select all

$cmd = "bash ~/etc/texteffect -t '1 long text 2 long text 3 long text 4 long text 5 long text' -s plain -e arc-top -a 180 -f font/foo.ttf -p 50 -c black -b none -l 1 -u none output.png";
The result is NOT correct. See this image:
Image

Let's try much longer text. Here is the $cmd to run.

Code: Select all

$cmd = "bash ~/etc/texteffect -t '1 long text 2 long text 3 long text 4 long text 5 long text 6 long text 7 long text 8 long text 9 long text 10 long text' -s plain -e arc-top -a 180 -f font/foo.ttf -p 50 -c black -b none -l 1 -u none output.png";
No image was created any more.

I ran these commands in SSH client and ALL the images are created correctly, even the longest text. Please see this image.
Image

Anyone knows what the problem is? Thank you,

Re: Wired problem to run Fred's Scripts in PHP

Posted: 2014-09-23T10:44:35-07:00
by fmw42
try this to see if any error messages and report back

Code: Select all

<?php
exec("bash ~/etc/texteffect -t '1 long text 2 long text 3 long text 4 long text 5 long text 6 long text 7 long text 8 long text 9 long text 10 long text' -s plain -e arc-top -a 180 -f font/foo.ttf -p 50 -c black -b none -l 1 -u none output.png 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

Re: Wired problem to run Fred's Scripts in PHP

Posted: 2014-09-24T05:32:34-07:00
by HankWolfe
Thanks for your reply. Here is the result for running this script:

1. Short text: no error message and the image is correct.

2. Longer text: one error message and the image was created but not arched.

Code: Select all

libgomp: Thread creation failed: Resource temporarily unavailable
3. Longest text: error messages are as below and no image was created.

Code: Select all

libgomp: Thread creation failed: Resource temporarily unavailable
identify: unable to open image `./texteffect_00_13601.mpc': No such file or directory @ error/blob.c/OpenBlob/2638.
identify: unable to open image `./texteffect_00_13601.mpc': No such file or directory @ error/blob.c/OpenBlob/2638.
convert: missing expression `' @ error/fx.c/FxEvaluateSubexpression/2119.
convert: unknown image property "%[fx:/2]" @ warning/property.c/InterpretImageProperties/3268.
convert: missing expression `' @ error/fx.c/FxEvaluateSubexpression/2119.
convert: unknown image property "%[fx:/2]" @ warning/property.c/InterpretImageProperties/3268.
convert: missing expression `' @ error/fx.c/FxEvaluateSubexpression/2119.
convert: unknown image property "%[fx:(+)/2]" @ warning/property.c/InterpretImageProperties/3268.
convert: missing expression `' @ error/fx.c/FxEvaluateSubexpression/2119.
convert: unknown image property "%[fx:(+)/2]" @ warning/property.c/InterpretImageProperties/3268.
convert: unable to open image `./texteffect_00_13601.mpc': No such file or directory @ error/blob.c/OpenBlob/2638.
convert: no images defined `./texteffect_00_13601.mpc' @ error/convert.c/ConvertImageCommand/3044.
convert: unable to open image `./texteffect_00_13601.mpc': No such file or directory @ error/blob.c/OpenBlob/2638.
convert: no images defined `/home2/ifullcol/www/ifullcolor/studio/fontimage/output.png' @ error/convert.c/ConvertImageCommand/3044.

Re: Wired problem to run Fred's Scripts in PHP

Posted: 2014-09-24T05:39:06-07:00
by HankWolfe
I did some research and fount this. http://stackoverflow.com/questions/1209 ... ert-in-php. This solves my problem.

Thank you,