Jump to content

[SOLVED] Making a dynamic animated gif


shadysaiyan

Recommended Posts

Thanks, looked through that, but i dont know how to convert any of it to PHP, i found this though

 

<?

 

//FULL PATH TO WHERE YOU WANT TO SAVE

$path = "/home/hsphere/local/home/USERNAME/yoursite.com/images/";

 

//THE COMMAND TO MAKE THE ANIMATION HAPPEN add more images if ya need to

$cmd = "/usr/local/bin/convert -dispose none -delay 20 FIRSTIMAGE.gif -delay 20 SECONDIMAGE.gif -loop 0 $path/animatedimage.gif";

 

 

//EXECUTE THE COMMAND AND CAPTURE ANY ERRORS

exec("$cmd 2>&1", $err);

 

foreach($err as $errline){

echo("$errline<br>");

}

 

?>

<!--display the animated image-->

<img src='animatedimage.gif'>

 

Source: http://support.jodohost.com/showthread.php?t=5513

 

I t looks like it works from the code, but when i run it in the browser, i get

 

Parse error: syntax error, unexpected T_STRING in /home/content/s/h/a/shadysaiyan/html/0.php on line 7

Give this a try:

 

<?
//FULL PATH TO WHERE YOU WANT TO SAVE
$path = "/home/hsphere/local/home/USERNAME/yoursite.com/images";

//THE COMMAND TO MAKE THE ANIMATION HAPPEN add more images if ya need to
$cmd = "/usr/local/bin/convert -dispose none -delay 20 FIRSTIMAGE.gif -delay 20 SECONDIMAGE.gif -loop 0 {$path}/animatedimage.gif";


//EXECUTE THE COMMAND AND CAPTURE ANY ERRORS
exec("{$cmd} 2>&1", $err);

foreach($err as $errline){
echo $errline;
}
?>

Okay,so i tried changing it so it would be, made from a png image, and then what would animate is the text, so every second or -20 delay it would change text.

 

<?

 

//FULL PATH TO WHERE YOU WANT TO SAVE

$path = "/home/content/s/h/a/shadysaiyan/html/";

 

$im = imagecreatefrompng("dnbar_1.png");

$white = ImageColorAllocate($im,255,255,255);

$font = 'fonts/EuropeExt_Bold.ttf';

 

//THE COMMAND TO MAKE THE ANIMATION HAPPEN add more images if ya need to

$cmd = "/usr/local/bin/convert -dispose none -delay 20 imagettftext({$im}, 12, 0, 5, 5, {$white}, {$font}, "shadysaiyan")

 

-delay 20 imagettftext({$im}, 12, 0, 5, 5, {$white}, {$font}, "posts count: xxx") -loop{$path}/shadysaiyan.gif";

 

 

//EXECUTE THE COMMAND AND CAPTURE ANY ERRORS

exec("{$cmd} 2>&1", $err);

 

foreach($err as $errline){

 

 

 

echo $errline;

}

?>

<!--display the animated image-->

<img src='shadysaiyan.gif'>

 

I just get a broken image. the image doesnt generate. how would i tweak the path output there to make it generate?

in your $path variable remove the last "/"

 

What is this for?

 

-delay 20 imagettftext({$im}, 12, 0, 5, 5, {$white}, {$font}, "posts count: xxx") -loop{$path}/shadysaiyan.gif";

 

doesn't it need to be in a variable, or be formatted better?

Sorry fro the double post again, but i've figured out how to go about this, first i have all the stats generated on their own individual images, then i make the animating code put them together into an animation. cant beliee i didnt think about it eirlier instead of tryin gto generate text onto nothing >_< thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.