Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This cannot be done with GD but I found a great library for it. It is a bit complicated though, so here is a link to the library which makes animated gifs with php. It explains how to use it thoroughly. <a href="http://www.phpclasses.org/package/3163-PHP-Generate-GIF-animations-from-a-set-of-GIF-images.html" rel="nofollow">http://www.phpclasses.org/package/3163-PHP-Generate-GIF-animations-from-a-set-of-GIF-images.html</a></p> <p>You can look at my example using this library:</p> <p>Just select 2 pictures and write 100 for speed 900 for width and height. It will put them in an animated gif slideshow.</p> <p>Here is the code for that script:</p> <pre><code>&lt;?php if(isset($_POST['speed'])) { header('Content-type: image/gif'); if(isset($_POST['download'])){ header('Content-Disposition: attachment; filename="animated.gif"'); } include('GIFEncoder.class.php'); function frame($image){ ob_start(); imagegif($image); global $frames, $framed; $frames[]=ob_get_contents(); $framed[]=$_POST['speed']; ob_end_clean(); } foreach ($_FILES["images"]["error"] as $key =&gt; $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["images"]["tmp_name"][$key]; $im = imagecreatefromstring(file_get_contents($tmp_name)); $resized = imagecreatetruecolor($_POST['width'],$_POST['height']); imagecopyresized($resized, $im, 0, 0, 0, 0, $_POST['width'], $_POST['height'], imagesx($im), imagesy($im)); frame($resized); } } $gif = new GIFEncoder($frames,$framed,0,2,0,0,0,'bin'); echo $gif-&gt;GetAnimation(); } ?&gt; &lt;form action="" method="post" enctype="multipart/form-data"&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script src="jquery.MultiFile.js"&gt;&lt;/script&gt; &lt;script src="jquery.placeholder.js"&gt;&lt;/script&gt; &lt;input type="file" name="images[]" class="multi" /&gt; &lt;script&gt; $(function(){ $('input[placeholder], textarea[placeholder]').placeholder(); }); &lt;/script&gt; &lt;SCRIPT language=Javascript&gt; &lt;!-- function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57)) return false; return true; } //--&gt; &lt;/SCRIPT&gt; &lt;input name="speed" maxlength="10" type="text" placeholder="Speed of frames in ms" onkeypress="return isNumberKey(event)"&gt; &lt;input name="width" maxlength="4" type="text" placeholder="Width" onkeypress="return isNumberKey(event)"&gt; &lt;input name="height" maxlength="4" type="text" placeholder="Height" onkeypress="return isNumberKey(event)"&gt; &lt;input type="submit" name="download" value="Download!"&gt; &lt;input type="submit" name="preview" value="Preview!"&gt; &lt;/form&gt; </code></pre> <p>As you see it references the GIFEncoder class found on the first link. It also uses some javascript validation and jQuery multiupload.</p> <p>BTW this question was already asked.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload