Jump to content

Creating a gif from images in a directory..


AndrewFerrara

Recommended Posts

So, We are trying to create a animation using the gifs in a directory by using the first 10 images. We just cannot figure out how to do the animation..

 

needs to have a 3 second delay between each frame

 

Heres the code at the moment. Which creates the starting images and also sorts the images in the directory by time..


<?php

$time = date("YmdHis");

$handle_data = file_get_contents('http://www.bungie.net/Stats/Halo3/Nightmap.ashx');
$img = new Imagick();
$img->readImageBlob($handle_data);
$img->writeImage('nightmap/'.$time.'.gif');



foreach (glob('nightmap/*.gif') as $f) {
    # store the image name
    $list[] = $f;
}

sort($list);# sort is oldest to newest,

$gif_0 = array_pop($list);
$gif_1 = array_pop($list);
$gif_2 = array_pop($list);
$gif_3 = array_pop($list);
$gif_4 = array_pop($list);
$gif_5 = array_pop($list);
$gif_6 = array_pop($list);
$gif_7 = array_pop($list);
$gif_8 = array_pop($list);
$gif_9 = array_pop($list);

?>

Archived

This topic is now archived and is closed to further replies.

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