Preferred way to copy JPG files from a remote server using PHP -


I am using PHP to copy JPGs from my remote server to my own server. Is it best to use only the copy () function, or is JPG-specific work better? For example:

  $ copy = copy ($ remote_url, $ dest_file);  

-OR -

$ img = imagecreatefromjpeg ($ remote_url); $ Copy = imagejpeg ($ img, $ dest_file); Imagedestroy ($ img);

What would be the best option in terms of speed and memory weight? Apart from this, will there be any difference in image quality as a result? I should add that this script is needed to copy large numbers of photos (usually hundreds, but sometimes it can be one thousand thousand).

Thanks, Brian

If you want a copy, copy () its better.

Using GD library functions (imagecreatefromjpeg / imagejpeg) to compress the image at the end (maybe, probably not smart, but probably). If you have images. PNG or something, you want to use GD (or ImageMagic)


Comments