Advertisement
Guest User

Untitled

a guest
Jan 15th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $filename = 'images.txt';
  2. displayTXTList($filename);
  3.  
  4. function displayTXTList($fileName) {
  5. if(file_exists($fileName)) {
  6. $file = fopen($fileName, 'r');
  7. while (!feof($file)) {
  8. $url = fgets($file);
  9. $image = basename($url);
  10. downloadImages($image);
  11. downloadImages(str_replace(".jpg", 'l.jpg', $image));
  12. downloadImages(str_replace(".jpg", 's.jpg', $image));
  13. }
  14. fclose($file);
  15. }
  16. }
  17.  
  18. function downloadImages($image) {
  19. echo 'http://i.imgur.com/'.$image;
  20. echo "<br/>";
  21. /*
  22. $ch = curl_init('http:////i.imgur.com//'.$image);
  23. $fp = fopen('images\\'.$image, 'wb');
  24. curl_setopt($ch, CURLOPT_FILE, $fp);
  25. curl_setopt($ch, CURLOPT_HEADER, 0);
  26. curl_exec($ch);
  27. curl_close($ch);
  28. fclose($fp);
  29. */
  30. //file_put_contents('images/'.$i, file_get_contents('http://i.imgur.com/'.$i));
  31. }
  32. ?>
  33.  
  34.  
  35.  
  36.  
  37.  
  38. // Output
  39. http://i.imgur.com/M8zKh.jpg
  40. http://i.imgur.com/M8zKhl.jpg
  41. http://i.imgur.com/M8zKhs.jpg
  42. http://i.imgur.com/SVW1G.jpg
  43. http://i.imgur.com/SVW1Gl.jpg
  44. http://i.imgur.com/SVW1Gs.jpg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement