title: GIF transparent background turned to black
body: <p>I have a script that resizes uploaded images. It works fine for PNGs and JPGs but with GIFs it renders the transparency in the resized GIF black.         </p>
  
  <pre><code>    $src = imagecreatefromgif($file);
      $dst = imagecreatetruecolor($newWidth, $newHeight);
      imagecopyresampled($dst, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); 
      imagegif($dst, $file);
  </code></pre>