Skip to content

Instantly share code, notes, and snippets.

@allometry
Created December 6, 2011 16:32
Show Gist options
  • Save allometry/1438845 to your computer and use it in GitHub Desktop.
Save allometry/1438845 to your computer and use it in GitHub Desktop.
Animated GIF Example
<?php
require("gifencoder.class.php");
header("Content-type: image/gif");
$images = (array)null;
$frames = (array)null;
for($i = 0; $i < 120; $i++) {
$image = imagecreatetruecolor(515, 98);
ob_start();
imagegif($image);
$images[] = ob_get_contents();
$frames[] = 100;
ob_end_clean();
imagedestroy($image);
}
$gif = new GIFEncoder($images, $frames, 1, 2, 0, 0, 0, 'bin');
echo $gif->GetAnimation();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment