Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $filename = 'images.txt';
- displayTXTList($filename);
- function displayTXTList($fileName) {
- if(file_exists($fileName)) {
- $file = fopen($fileName, 'r');
- while (!feof($file)) {
- $url = fgets($file);
- $image = basename($url);
- downloadImages($image);
- downloadImages(str_replace(".jpg", 'l.jpg', $image));
- downloadImages(str_replace(".jpg", 's.jpg', $image));
- }
- fclose($file);
- }
- }
- function downloadImages($image) {
- echo 'http://i.imgur.com/'.$image;
- echo "<br/>";
- /*
- $ch = curl_init('http:////i.imgur.com//'.$image);
- $fp = fopen('images\\'.$image, 'wb');
- curl_setopt($ch, CURLOPT_FILE, $fp);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_exec($ch);
- curl_close($ch);
- fclose($fp);
- */
- //file_put_contents('images/'.$i, file_get_contents('http://i.imgur.com/'.$i));
- }
- ?>
- // Output
- http://i.imgur.com/M8zKh.jpg
- http://i.imgur.com/M8zKhl.jpg
- http://i.imgur.com/M8zKhs.jpg
- http://i.imgur.com/SVW1G.jpg
- http://i.imgur.com/SVW1Gl.jpg
- http://i.imgur.com/SVW1Gs.jpg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement