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);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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