title: imagecreatetruecolor() makes my image lose quality
body: <p>I'm using the script below to create an JPG based on people uploading an image. What happens is that even if an image is the exact same width/height it still loses quality so much that it's unacceptable. </p>
  
  <pre><code>$im = imagecreatefromjpeg($_FILES['cpicture']['tmp_name']);
  $thumb=imagecreatetruecolor(507,307);
  ImageCopyResampled($thumb,$im,0,0,0,0,$newwidth,$newheight,ImageSX($im),ImageSY($im));
  ImagejpeG($thumb,"uploads/".$randomvalue.".jpg");
  $imgurl="uploads/".$randomvalue.".jpg";
  </code></pre>
  
  <p>Are these functions reducing the quality?</p>