title: How to resize image from url and upload it?
body: <p>The code below resizes an image url. But I would like to upload this output as a image url:</p>
  
  <pre><code>&lt;?php
  // The file
  $filename = 'http://valplibrary.files.wordpress.com/2009/01/5b585d_merry-christmas-blue-style.jpg';
  $percent = 0.5; // percentage of resize
  
  // Content type
  header('Content-type: image/jpeg');
  
  // Get new dimensions
  list($width, $height) = getimagesize($filename);
  $new_width = $width * $percent;
  $new_height = $height * $percent;
  
  // Resample
  $image_p = imagecreatetruecolor($new_width, $new_height);
  $image = imagecreatefromjpeg($filename);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  
  // Output
  imagejpeg($image_p, null, 100);
  ?&gt;
  </code></pre>
  
  <p>How can I do it?</p>