Login   Register  
PHP Classes
elePHPant
Icontem

File: slideshow.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Phil Bayfield  >  GIF Creator  >  slideshow.php  >  Download  
File: slideshow.php
Role: Example script
Content type: text/plain
Description: Slideshow example script
Class: GIF Creator
Create animations in GIF format from an image list
Author: By
Last change: Bug fix
Date: 2009-12-29 01:53
Size: 1,026 bytes
 

Contents

Class file image Download
<?php
/**
 * Slideshow Demo
 *
 * Creates a slideshow of 5 images which are resampled from 1200x800 to 600x400
 * with an overlay added to the final frame.
 */

// Include the class
require_once('GifCreator.php');

// Instanciate the class (uses default options with the addition of width/height specified)
$gif = new GifCreator(02, array(-1, -1, -1), 600400);

// Add each frame to the animation
$gif->addFrame(file_get_contents('images/1.jpg'), 200true);
$gif->addFrame(file_get_contents('images/2.jpg'), 200true);
$gif->addFrame(file_get_contents('images/3.jpg'), 200true);
$gif->addFrame(file_get_contents('images/4.jpg'), 200true);
// Disposal set to 0 for this frame so that following frame becomes overlay
$gif->addFrame(file_get_contents('images/5.jpg'), 200true000);
// Overlay frame
$gif->addFrame(file_get_contents('images/6.gif'), 200false1501502, array(255255255));

// Output the animated gif
header('Content-type: image/gif');
echo 
$gif->getAnimation();