title: reduce image size while uploading using the following PHP code used to upload image
body: <p>Am trying to upload image to server using the following code 
  Following are done with the given code below</p>
  
  <ul>
  <li>Upload file renaming<br>What i need is i need to reduce image size with the following code<br> </li>
  </ul>
  
  <p>Here is the code</p>
  
  <pre><code> $file_name = $HTTP_POST_FILES['ufile']['name'];
   $random_digit = md5(rand() * time());
   $new_file_name = $random_digit . $file_name;
   $path = "upload/" . $new_file_name;
   if ($ufile != none) {
      if (copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)) {
          echo "Successful&lt;BR/&gt;";
          echo "File Name :" . $new_file_name . "&lt;BR/&gt;";
          echo "File Size :" . $HTTP_POST_FILES['ufile']['size'] . "&lt;BR/&gt;";
          echo "File Type :" . $HTTP_POST_FILES['ufile']['type'] . "&lt;BR/&gt;";
      } else {
          echo "Error";
      }
   }
  </code></pre>
  
  <p>how to reduce image size with the given code</p>