title: PHP uploading seems to default to 72 dpi, I need 300 dpi
body: <p>I have a page while is used only for print, and some of the images on there are uploaded through a script I have.  It seems to always reduce the image to 72 dpi, reguardless of what I set <code>imagejpeg()</code> and <code>imagepng()</code> to for quality.  </p>
  
  <p>I've used my own personal script and this one on git hub</p>
  
  <p><a href="https://github.com/maxim/smart_resize_image" rel="nofollow">https://github.com/maxim/smart_resize_image</a></p>
  
  <p>I was hoping for a little guidance on preserving the dpi at the original 300dpi.</p>
  
  <p>Here is my own personal script</p>
  
  <pre><code>if (!empty($_FILES['image']['name'])) //checking if file upload box contains a value
      {   
          $saveDirectory = 'pics/';           //name of folder to upload to
          $tempName = $_FILES['image']['tmp_name'];   //getting the temp name on server
          $fileName1 = $_FILES['image']['name'];      //getting file name on users computer
  
          $count = 1;
          do{
          $location = $saveDirectory . $_GET['section'] . $count . $fileName1;
          $count++; 
          }while(is_file($location));
  
          if (move_uploaded_file($tempName, $location))   //Moves the temp file on server
              {                                                           //to directory with real name
                  $image = $location;
  
                  // Get new sizes
                  list($width, $height, $type) = getimagesize($image);    //gets information about new server image
  
                  $framewidth = 932;
                  $frameheight = 354;
  
                  $realwidth = $width;    //setting original width and height
                  $realheight = $height;
  
                  // Load
                  $file1new = imagecreatetruecolor($framewidth, $frameheight);    //creates all black image with target w/h
  
                  if($type == 2){
                      $source = imagecreatefromjpeg($image);
                      imagecopyresampled($file1new, $source , 0, 0, 0, 0, $framewidth, $frameheight, $realwidth, $realheight);
                  }
                  elseif($type == 3){
                      $source = imagecreatefrompng($image);    
                      imagecopyresampled($file1new, $source , 0, 0, 0, 0, $framewidth, $frameheight, $realwidth, $realheight);
                  }
                  else{
                      echo "Wrong file type";
                  }
  
                  if($type == 2){
  
                      //creates jpeg image from file1new for file1 (also retains quality)
                      imagejpeg($file1new, $image,100);
                      //frees space
                      imagedestroy($file1new);
                  }
                  elseif($type == 3){
  
                      //creates png image from file1new for file1 (also retains quality)
                      imagepng($file1new, $image,10);
                      //frees space
                      imagedestroy($file1new);
                  }
                  else{
                      echo "Wrong file type";
                  } 
              } 
              else 
              {
                  echo '&lt;h1&gt; There was an error while uploading the file.&lt;/h1&gt;';
              }
          }
  }
  </code></pre>
  
  <p>Edit: Even if dpi isn't the answer, as I see jpgs in specific don't retain that information. I need some way of keeping these images very clear and crisp.</p>