This may be a strange question, but I have this loop here:
foreach ($friends["data"] as $value) {
echo '<img src="https://graph.facebook.com/' . $value["id"] . '/picture?type=large"/> <br />
}
Running this opens over 2000 images.
I need to download each of these images to a folder on my desktop with the name 1.jpg, 2.jpg, 3.jpg, etc.
Frankly this is weird to me, and I don't even know how to try and research how to do this. This images aren't huge, but the do need to stay in order as they will be lined up later with captions that are numbered.
Any help greatly appreciated!
I tried this:
foreach ($friends["data"] as $value) {
$i = 1;
echo '<img src="https://graph.facebook.com/' . $value["id"] . '/picture?type=large"/> <br />';
$url = 'https://graph.facebook.com/' . $value["id"] . '/picture?type=large';
$img = '/me/Desktop/Facebook/'.$i.'.jpg';
file_put_contents($img, file_get_contents($url));
$i++;
}
but I got the error: Warning: file_put_contents(/me/Desktop/Facebook/1.jpg) [function.file-put-contents]: failed to open stream: No such file or directory in /home/blahblah blah on line 125