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
Link to comment
Share on other sites

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;
}
?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.