title: PHP Save Image After imagecopyresampled
body: <pre><code>$image_p = imagecreatetruecolor($new_width, $new_height);
  $image = imagecreatefromjpeg($filename);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  </code></pre>
  
  <p>How can i save the resized image to folder/ ?
  And how can I detect the image type is jpg/png/gif?</p>