title: Preferred way to copy JPG files from a remote server using PHP
body: <p>I'm using PHP to copy JPGs from a remote server to my own server.  Is it best to simply use the <code>copy()</code> function, or are the jpeg-specific functions better?  For example:</p>
  
  <pre><code>$copy = copy($remote_url, $dest_file);
  </code></pre>
  
  <p>-OR-</p>
  
  <pre><code>$img = imagecreatefromjpeg($remote_url);
  $copy = imagejpeg($img, $dest_file);
  imagedestroy($img);
  </code></pre>
  
  <p>What would the best option be in terms of speed and memory load?  Also, would there be any difference in the resulting image quality?  I should add that this script is required to copy a large number of photos (typically hundreds, but sometimes it may be a couple thousand).</p>
  
  <p>Thanks, Brian</p>