Login   Register  
PHP Classes
elePHPant
Icontem

File: gdExt_0.1.0a1/test_gdExtAnimatedGIF.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Victor Akinyemi  >  PHP GIF Animation Class  >  gdExt_0.1.0a1/test_gdExtAnimatedGIF.php  >  Download  
File: gdExt_0.1.0a1/test_gdExtAnimatedGIF.php
Role: Example script
Content type: text/plain
Description: Creating animated GIF example.
Class: PHP GIF Animation Class
Draw graphics and generate animated GIF images
Author: By
Last change:
Date: 1 year ago
Size: 1,578 bytes
 

Contents

Class file image Download
<?php

header 
('Content-Type: image/gif');
include(
'gdExtAnimatedGIF.class.php');
include(
'gdExtImage.class.php');

$text "Hello World";

/*
// Open the first source image and add the text.
$image = imagecreatefrompng('source01.png');
$text_color = imagecolorallocate($image, 200, 200, 200);
imagestring($image, 5, 5, 5,  $text, $text_color);

// Generate GIF from the $image
// We want to put the binary GIF data into an array to be used later,
//  so we use the output buffer.
ob_start();
imagegif($image);
$frames[]=ob_get_contents();
$framed[]=40; // Delay in the animation.
ob_end_clean();
*/
$image = new gdExtImage(NULL200200, array(50,50,90));
$image->text(5,5,5,$text);
ob_start();
$image->save('gif');
$frames[]=ob_get_contents();
$framed[]=40;
ob_end_clean();

// And again..

/*
// Open the first source image and add the text.
$image = imagecreatefrompng('source02.png');
$text_color = imagecolorallocate($image, 200, 200, 200);
imagestring($image, 5, 20, 20,  $text, $text_color);

// Generate GIF from the $image
// We want to put the binary GIF data into an array to be used later,
//  so we use the output buffer.
ob_start();
imagegif($image);
$frames[]=ob_get_contents();
$framed[]=40; // Delay in the animation.
ob_end_clean();
*/
$image = new gdExtImage(NULL200200, array(5,5,200));
$image->text(5,20,20,$text);
ob_start();
$image->save('gif');
$frames[]=ob_get_contents();
$framed[]=40;
ob_end_clean();

// Generate the animated gif and output to screen.
$gif = new gdExtAnimatedGIF($frames,$framed,0,2,0,0,0,'bin');
echo 
$gif->getAnimation();

?>