title: Moving animated gif file using imagegif causes it to lose animation
body: <p>I have a script that uploads an image using JavaScript, as seen <a href="https://stackoverflow.com/questions/9785948/how-to-save-image-server-side-when-send-from-javascript">here</a>.</p>
  <p>I solved the problem from that post. Now I take the contents from the JavaScript call and save it to a temp_file. After that I resize it, rename etc and save it to
  a final location.</p>
  <p>It works fine until I try to do it with a .gif (I skip all resizing on .gifs).</p>
  <p>Here is how I do it:</p>
  <pre><code>//$filename = the temp_image that is alredy stored (animated gif)
  $this-&gt;image = imagecreatefromgif($filename);
  
  header('Content-Type: image/gif');
  
  imagegif($this-&gt;image,$savepath);
  
  unlink($filename);
  </code></pre>
  <p>The temp_file is still animated, but after moving it to <code>$savepath</code> it loses its animation.</p>
  <p>What could cause this to happen and how can I fix it?</p>