title: imagecopyresized() invalid image dimensions?
body: <p>I get the following error when trying to create a thumbnail of an image:</p>
  
  <pre><code>Warning: imagecopyresized() [function.imagecopyresized]: Invalid image dimensions in H:\Programs\webserver\root\media\images\inc\func.php on line 160
  </code></pre>
  
  <p>This is the function I have created to do the job:</p>
  
  <pre><code>function create_thumbnail($image_type, $image_height, $image_height, $temp_dir, $thumb_path, $thumb_width, $thumb_height){
      switch($image_type){
          case 'image/jpeg';
              $img =      imagecreatefromjpeg($temp_dir);
              $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                          imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height);
                          imagejpeg($thumb, $thumb_path, 100);
  
  
          break;
          case 'image/png';
              $img =      imagecreatefrompng($temp_dir);
              $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                          imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height );
                          imagepng($thumb, $thumb_path, 100);
  
          break;
          case 'image/gif';
              $img =      imagecreatefromgif($temp_dir);
              $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                          imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height );
                          imagegif($thumb, $thumb_path, 100);
  
          break;
      }
  
  }
  </code></pre>
  
  <p>Which is used like so:</p>
  
  <pre><code>// Create the new thumbnail dimensions
                          list($thumb_width, $thumb_height) = thumb_dimensions($case, $image_width, $image_height);
  
                          // Create the thumbnails
                          create_thumbnail($image_type, $image_height, $image_height, $temp_dir, $thumb_path, $thumb_width, $thumb_height);
  </code></pre>
  
  <p>The thumb dimensions are width: 100px, height: 99px;</p>