Jump to content

Using PHP To Save An Image on my computer


Exoon

Recommended Posts

Hello,

 

I was wondering if it was possible to get PHP to save a load of images onto my computer.

 

Ive got code to read the website i want the images from and i can get the URL of every image i need but i dont want to manually save them 1by1.

 

Any Help would be great.

 

Thanks!

Link to comment
Share on other sites

Yes/No

You can save them to the PHP server.. if thats on your computer then yes..

if its not then you could creates and archive and save that (or have a ton of save prompts for each file)

 

easy option.. install WAMP. create a script to leach the images ie

<?php
$URLs[] = "http://blar.com/images.test1.jpg";
$URLs[] = "http://blar.com/images.test2.jpg";
$URLs[] = "http://blar.com/images.test3.jpg";
$URLs[] = "http://blar.com/images.test4.jpg";
$URLs[] = "http://blar.com/images.test5.jpg";

foreach($URLs as $URL)
{
//save Image to local
$file = file_get_contents($URL);
file_put_contents("SaveImageToPath/".basename($URL),$file);
}
?>

 

EDIT: updated

remember this is a basic example and save all images to the same folder ..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.