Page 1 of 1

whats is wrong in this code???

Posted: 2011-12-18T00:32:50-07:00
by sriducati
what is wrong in this code ?? why is it not generating glitter text???
<?php

exec("convert -background transparent -font 'Times-Roman.ttf' -pointsize 72 label:Glitter -stroke black -strokewidth 2

\( -clone 0 -tile 'glitter_plasma.gif[0]' -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) \
\( -clone 0 -tile 'glitter_plasma.gif[1]' -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) \
\( -clone 0 -tile 'glitter_plasma.gif[2]' -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) \
-delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize masked.gif");

?>

where is glitter_plasma.gif is the glitter image...
please help me

Re: whats is wrong in this code???

Posted: 2011-12-18T17:25:26-07:00
by anthony
Missing a back slash at an end of line, also the extra blank line will separate the command into two commands!

Also using exec() with double quotes require backslashes to be doubled up, to escape the escapes them in PHP as well as in shell.

For PHP formatting a better way is shown in
http://www.imagemagick.org/Usage/api/#php

Or See 'Rubble web page... IM coding basics
http://www.rubblewebs.co.uk/imagemagick ... xplain.php

And/Or Formatting PHP code...
http://www.rubblewebs.co.uk/imagemagick ... format.php

Re: whats is wrong in this code???

Posted: 2011-12-19T04:25:40-07:00
by sriducati
anthony wrote:Midding a back slash at an end of line, extra blank line will seperate the commands.

Also using exec() with double quotes require backslashes to be doubled up, to excape the excapes them in PHP as well as in shell.

For PHP formatting a better way is shown in
http://www.imagemagick.org/Usage/api/#php

Or See 'Rubble web page... IM coding basics
http://www.rubblewebs.co.uk/imagemagick ... xplain.php

And/Or Formatting PHP code...
http://www.rubblewebs.co.uk/imagemagick ... format.php
tried as you told but no go.. if you dont mind can you please the correct the above code and write it ..

Re: whats is wrong in this code???

Posted: 2011-12-19T05:38:02-07:00
by Bonzo
Try writing your code like this:

Code: Select all

<?php

$cmd = " -background transparent -font \"Times-Roman.ttf\" -pointsize 72 label:Glitter -stroke black -strokewidth 2 ".
"  \( -clone 0 -tile \"glitter_plasma.gif[0]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[1]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[2]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \)  ".
"  -delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize masked.gif";

exec("convert $cmd Optimize masked.gif");
?>
Code untested as I am at work.

Are you on a windows or linux server or windows localhost?

Re: whats is wrong in this code???

Posted: 2011-12-19T23:19:32-07:00
by sriducati
Bonzo wrote:Try writing your code like this:

Code: Select all

<?php

$cmd = " -background transparent -font \"Times-Roman.ttf\" -pointsize 72 label:Glitter -stroke black -strokewidth 2 ".
"  \( -clone 0 -tile \"glitter_plasma.gif[0]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[1]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[2]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \)  ".
"  -delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize masked.gif";

exec("convert $cmd Optimize masked.gif");
?>
Code untested as I am at work.

Are you on a windows or linux server or windows localhost?
Thanks for your reply Bonzo.. unfortunately even the above code did not work or did not create any image nameed"masked.gif" .. WELL IAM USING LINUX SERVER "CENTOS" I have tested all rubblewebs php text codes which works fine.. iam having problem with glitter...

Re: whats is wrong in this code???

Posted: 2011-12-20T00:55:12-07:00
by Bonzo
Try changing this and see if you get an error displayed:

Code: Select all

$array=array();
echo "<pre>";
exec("convert $cmd masked.gif 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
I have just noticed I had Optimize again in the exec line

Re: whats is wrong in this code???

Posted: 2011-12-20T05:24:08-07:00
by sriducati
Hi Bonzo,

I have changed the code to

Code: Select all

<?php

$cmd = " -background transparent -font \"Times-Roman.ttf\" -pointsize 72 label:Glitter -stroke black -strokewidth 2 ".
"  \( -clone 0 -tile \"glitter_plasma.gif[0]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[1]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[2]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \)  ".
"  -delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize masked.gif";

$array=array();
echo "<pre>";
exec("convert $cmd masked.gif 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
I gGOT THIS ERROR MESSAGE

Code: Select all

Array
(
    [0] => convert: unable to read font `Times-Roman.ttf'.
    [1] => convert: unable to read font `/usr/share/fonts/default/TrueType/arial.ttf'.
    [2] => convert: image sequence is required `-clone'.
)

1
I CHANGED THE CODE TO

Code: Select all

<?php

$cmd = " -background transparent -font Times-Roman -pointsize 72 label:Glitter -stroke black -strokewidth 2 ".
"  \( -clone 0 -tile \"glitter_plasma.gif[0]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[1]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[2]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \)  ".
"  -delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize masked.gif";

$array=array();
echo "<pre>";
exec("convert $cmd masked.gif 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
Now iam getting...

Code: Select all

Array
(
)

1
IT IS WORKING.... SUPERB ..THANKS ALOT : :D

BUT A SMALL PROBLEM WHEN I CHANGE THE "LABEL" TO DIFFERENT WORD AND USE THE SAME IMAGE NAME "MASKED.GIF" ,,, IT WILL NOT REWRITE THE FILE IT BLINKS ON THE OLD FILE ..PLEASE CHECK Image ...WHERE GLITTER IS THE OLD LABEL NAME AND SRINIVAS IS THE NEW LABEL NAME..AFTER EXECUTING I GET THAT IMAGE... ANY IDEA TO FIX THIS SIMPLE PROBLEM???

Re: whats is wrong in this code???

Posted: 2011-12-20T08:34:55-07:00
by Bonzo
Another mistake of mine - I should double check what I post.

Code: Select all

<?php

$cmd = " -background transparent -font Times-Roman -pointsize 72 label:Glitter -stroke black -strokewidth 2 ".
"  \( -clone 0 -tile \"glitter_plasma.gif[0]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[1]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \) ".
"  \( -clone 0 -tile \"glitter_plasma.gif[2]\" -stroke black -strokewidth 2 -gravity center -annotate +0+0 Glitter \)  ".
"  -delete 0 -set delay 15 -loop 0 -trim +repage -layers Optimize ";

$array=array();
echo "<pre>";
exec("convert $cmd masked.gif 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
I had masked.gif in the $cmd and the exec lines.

Another things could be caching; try creating a file with a different name each time then deleting it?

Re: whats is wrong in this code???

Posted: 2011-12-21T04:55:40-07:00
by sriducati
Hello Bonzo,

Superb... works perfectly as we wish...just one sentance "YOU ARE AMAzzzING' :D :D :D :D :D :D well now i have one more doubt ,iam planning to replace glitter image with animated images like {flame} ... i dont thinki it works if i just replace filename...any idea on how to fix that????

Re: whats is wrong in this code???

Posted: 2011-12-21T10:43:13-07:00
by Bonzo
I am glad you got it sorted and would have thougt it would work but your flame.gif would need to be high enough that it was not tiled verticaly!