whats is wrong in this code???
whats is wrong in this code???
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
<?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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: whats is wrong in this code???
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: whats is wrong in this code???
tried as you told but no go.. if you dont mind can you please the correct the above code and write it ..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
Re: whats is wrong in this code???
Try writing your code like this:
Code untested as I am at work.
Are you on a windows or linux server or windows localhost?
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");
?>
Are you on a windows or linux server or windows localhost?
Re: whats is wrong in this code???
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...Bonzo wrote:Try writing your code like this:Code untested as I am at work.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"); ?>
Are you on a windows or linux server or windows localhost?
Re: whats is wrong in this code???
Try changing this and see if you get an error displayed:
I have just noticed I had Optimize again in the exec line
Code: Select all
$array=array();
echo "<pre>";
exec("convert $cmd masked.gif 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
Re: whats is wrong in this code???
Hi Bonzo,
I have changed the code to
I gGOT THIS ERROR MESSAGE
I CHANGED THE CODE TO
Now iam getting...
IT IS WORKING.... SUPERB ..THANKS ALOT :
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
...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???
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>";
?>
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
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>";
?>
Code: Select all
Array
(
)
1

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

Re: whats is wrong in this code???
Another mistake of mine - I should double check what I post.
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?
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>";
?>
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???
Hello Bonzo,
Superb... works perfectly as we wish...just one sentance "YOU ARE AMAzzzING'
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????
Superb... works perfectly as we wish...just one sentance "YOU ARE AMAzzzING'






Re: whats is wrong in this code???
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!