Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added test/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions test/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace GifCreator;

require_once '../src/GifCreator/GifCreator.php';

// Create an array containing file paths, resource var (initialized with imagecreatefromXXX),
// image URLs or even binary code from image files.
// All sorted in order to appear.
$frames = array(
"1.png",
"2.png",
);

// Create an array containing the duration (in millisecond) of each frames (in order too)
$durations = array(40, 80, 40);

// Initialize and create the GIF !
$gc = new GifCreator();
$gc->create($frames, $durations, 5);


$gifBinary = $gc->getGif();

if (isset($_GET['save'])) {
file_put_contents('final.gif', $gifBinary);
}else{
header('Content-type: image/gif');
header('Content-Disposition: filename="butterfly.gif"');
echo $gifBinary;
exit;
}