0

Here is the problem:

I am getting a streamfrom a image overlay web service.

The string is something like this:

$string = http://[ipaddress]/faceCrop/Z%3A%5Ccelebhair%5CHair2-148_172_278_378.png/Z%3A%5Cprofilepictures%5C9ef14819f0.png/90/40/300/466

I then render the image out like this:

<img src="<?php echo $string;?>">

This displays the image correctly.

However, I need to save the image (automatically) to a folder on the server.

How can I save the datastream as a physical image with either PHP or Javascript?

Thanks

J

Jacques
  • 1,649
  • 2
  • 14
  • 23

1 Answers1

1

You must get the contents of the file, and then save the contents..

$fileContent = file_get_contents($url);
file_put_contents($filePath, $fileContent);
RaggaMuffin-420
  • 1,762
  • 1
  • 10
  • 14