title: Image quality goes down in php file image upload
body: <p>I am using a simple image upload php code but the image quality goes down for 100x100 50x50. How can I increase image quality?</p>
  
  <p>I want to a use good quality of photos when they get uploaded.</p>
  
  <pre><code>if($extension=="jpg" || $extension=="jpeg" )
  {
  $uploadedfile = $_FILES['file']['tmp_name'];
  $src = imagecreatefromjpeg($uploadedfile);
  
  }
  else if($extension=="png")
  {
  $uploadedfile = $_FILES['file']['tmp_name'];
  
   $src= imagecreatefrompng($uploadedfile);
  imagealphablending($src, false);
  imagesavealpha($src, true);
  imagealphablending($src, false);
  imagesavealpha($src, true);
  }
  else 
  {
  $src = imagecreatefromgif($uploadedfile);
  }
  
  echo $scr;
  
  list($width,$height)=getimagesize($uploadedfile);
  
  if($width&gt;75)
  {
  
  $newwidth=50;
  $newheight=($height/$width)*$newwidth;
  $tmp=imagecreatetruecolor($newwidth,$newheight);
  
  
  $newwidth1=100;
  $newheight1=($height/$width)*$newwidth1;
  $tmp1=imagecreatetruecolor($newwidth1,$newheight1);
  
  imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
  
  imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height);
  
  
  $ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
  
  $mainfilename = $username.".".$ext;
  
  
  $filename = "pics/50/". $username.".".$ext;
  
  $filename1 = "pics/100/". $username.".".$ext;
  
  imagejpeg($tmp,$filename,50);
  
  imagejpeg($tmp1,$filename1,100);
  </code></pre>
  
  <p>Can anybody help me to create 4 size thumbnail photos using one large photo but with good quality?</p>