1

No matter which function I'm using:

copy("http:" . $imglink, "images/" . substr($imglink, 34));
//or
file_put_contents("images/" . substr($imglink, 34), file_get_contents("http:" . $imglink));
//or
file_put_contents("images/" . $productData['imagefile'], fopen($productData['imagelink'], 'r'));

the files are saved broken and almost 4 times bigger. No errors in the log, already checked that I can manually download healthy images from the remote server through the browser. Any ideas?

1000Gbps
  • 1,455
  • 1
  • 29
  • 34

1 Answers1

0

Found the problem - the image filename contains space char which should be rawurlencode($imglink)-ed before it is passed as argument

1000Gbps
  • 1,455
  • 1
  • 29
  • 34