You are Unregistered, please register to gain Full access.
    

Showcase Discuss, [PHP/OOP] 4chan image downloader V2 at Coders' Paradise forum; This is the next version of 4chan Image downloader I've added a gallery which let's you select which images you ...


RaGEZONE sponsored advertisment:

 
 
LinkBack Thread Tools
Old 01-24-2009   #1 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

[PHP/OOP] 4chan image downloader V2 !UPDATED!

This is the next version of 4chan Image downloader I've added a gallery which let's you select which images you want to download. So you don't accidentally download 20 furry porn wallpapers to your server.

Requirements:
  • PHP 4.0 or higher (5.0 or higher recommended)
  • A web server which let's you edit ini settings.

Screenshots:

http://forum.ragezone.com/attachment...v2-gallery.jpg

How to use:

Put the script anywhere on your web server, call it "4chan_images.php" then create a directory called "images" (This can be changed). Then run the script and everything should be self-explanatory.

Script:

PHP Code:
<?php
error_reporting
(0);

class 
image_downloader 

    public 
$url;
    
    protected function 
get_source() {
    
        if((
$source = @file_get_contents($this->url)) == false) {
        
            die(
"Could not open thread.");
        
        }
    
        return 
$source;
    }
    
    protected function 
get_file_link() {
    
        
$source $this->get_source();
        
$i 0;  
            
        
preg_match_all("/\"\>File(.*?)\<blockquote\>/is"$source$matches_image);
        
        while(
$i count($matches_image[1])) {
        
            
preg_match("/\<a href\=\\\"(.*?)\\\" target\=/is"$matches_image[0][$i], $images_array[$i]);
                    
            
$i ++;
            
        }
                    
        return 
$images_array;
                
    }
    
    public function 
get_images() {
    
        
$a_images $_POST['amount'];
        
$i 0;
        
        while(
$i $a_images) { 
        
            if(isset(
$_POST["image_$i"])) {
            
                
$images_array[$i] .= $_POST["image_$i"];
            }
            
            
$i ++;
            
        }
        
        return 
$images_array;
        
    }
    
    public function 
save_file() {
    
        
$images_array $this->get_images();
        
$i 0;
        
$errors 0;
        
$file "";
        
        while(
$i count($images_array)) {
        
            
$extension preg_replace("/.*\./is"""$images_array[$i]);
    
            if((
$handle_external = @fopen($images_array[$i], "r"))) {
            
                while(
$line fread($handle_external8192)) {
                
                    
$file .= $line;
                    
                }
                
//Change the directory between quotes to change the directory the images will be downloaded to.
                
while(($handle_internal fopen("images/".rand(0,9999999999999).".$extension""x+"))== false)
                
                
fclose($handle_external);
                
fwrite($handle_internal$file);
                
fclose($handle_internal);
                unset(
$handle_external$line$file$handle_internal);
                
            } else {
            
                
$errors ++;
                
            }
            
            
$i ++;
            
        }
            
        echo 
$errors " image(s) not saved.<br/><br/><a href='".$_SERVER['PHP_SELF']."'>&lt;&lt;back</a>";
        
    }                
}
class 
display_images extends image_downloader {

    public 
$url;

    private function 
get_thumbs() {
    
        
$source $this->get_source();
        
$i 0;  
            
        
preg_match_all("/\"\>File(.*?)\<blockquote\>/is"$source$matches_image);
        
        while(
$i count($matches_image[1])) {
        
            
preg_match("/img src=([a-z0-9:\/\.]*)/is"$matches_image[1][$i], $thumbs_array[$i]);
                    
            
$i ++;
            
        }
        
        return 
$thumbs_array;
                
    }
    
    public function 
d_img_form() {
    
        
$thumbs_array $this->get_thumbs();
        
$images_array $this->get_file_link();
        
$i 0;
        
$thumbs "";
        
        echo 
'<form name="image_form" method="post" action="4chan_images.php">';
        echo 
"\n";
        echo 
'<table cellspacing ="5" border ="0" align="center">';
        echo 
"\n";
        
        while(
$i count($thumbs_array)) {
        
            if(
$i == 0) {
            
                
$thumbs .= "<td><div style='width:130px; height:130px; background-color:#000000;' align='center'><input type='checkbox' checked='checked' name='image_$i' value='".$images_array[$i][1]."' style='float:right;'/><a href='".$images_array[$i][1]."' target='_blank'><img src='".$thumbs_array[$i][1]."' alt='Thumbnail $i' height='100px' width='126px' border='0'/></a></div></td>\n";
            } else {    
        
                
$thumbs .= "<td><div style='width:130px; height:130px; background-color:#000000;' align='center'><input type='checkbox' checked='checked' name='image_$i' value='".$images_array[$i][1]."' style='float:right;'/><a href='".$images_array[$i][1]."' target='_blank'><img src='".$thumbs_array[$i][1]."' alt='Thumbnail $i' style='max-height:115px;' border='0'/></a></div></td>\n";
                        
                if(((
$i+1) % $_POST['images_row'] == 0) || (count($thumbs_array) - $i == 1)) {
                    
                    echo 
"<tr>\n";
                    echo 
$thumbs;
                    echo 
"</tr>\n";
                                
                    
$thumbs "";
                }
            }
            
$i ++;
        }
        
        echo 
"</table>";
        echo 
"<input type='hidden' name='amount' value='".count($thumbs_array)."'/>";
        echo 
"\n <br/> \n";
        echo 
'<div align="center"><input type="submit" name="download" value="download"/></div>';
        echo 
'</form>';
            
    }
}        
    
set_time_limit(0);
ini_set("max_execution_time""0");

if(!isset(
$_POST['get_thread']) && !isset($_POST['download'])) {

    
?>
    <form method="post" action="">
    Link to thread:<br/>
    <input type="text" size="55" name="link" />
    <br/>
    Amount of images per row
    <select name="images_row">
    <option value="10">10</option>
    <option value="9">9</option>
    <option value="8">8</option>
    <option value="7">7</option>
    <option value="6">6</option>
    <option value="5">5</option>
    <option value="4">4</option>
    <option value="3">3</option>
    <option value="2">2</option>
    <option value="1">1</option>
    </select>
    <br/>
    <input type="submit" value="submit" name="get_thread" />
    </form>
    <?php
    
} else if(!isset($_POST['download'])) {

    
$display = new display_images();
    
$display -> url $_POST['link'];
    
$display -> d_img_form(); 
    
} else {

    
$downloader = new image_downloader();
    
$downloader -> save_file(); 

}
?>
If you encounter any bugs, please post them here and I'll try to fix them.

10-10-09: Updated the script, it now works again with all boards. It now also downloads the first image of every thread. Something the previous script didn't. Sorry it took so long.
Attached Images
This post has an attachment which you could see if you were registered. Registering is quick and easy
__________________

Last edited by Pieman; 10-16-2009 at 09:37 AM.
Pieman is offline   Reply With Quote
Thanked by :

RaGEZONE sponsored advertisment:
Old 01-24-2009   #2 (permalink)
slut
 
Cask's Avatar


Rank: Member +
Join Date: Jul 2007
Posts: 1,016
Thanked 0 Times in 0 Posts

Re: [PHP/OOP] 4chan image downloader V2

Thank you, kind sir!
Cask is offline   Reply With Quote

Endorsement
Old 02-01-2009   #3 (permalink)
:)


Rank: Alpha Member
Join Date: Jan 2009
Location: Illinois, U.S.
Posts: 2,496
Thanked 138 Times in 47 Posts

Re: [PHP/OOP] 4chan image downloader V2

Yay. Now I can has my CP without going to 4chan!
Horizon is offline   Reply With Quote

Endorsement
<a onclick="_gaq.push(['_trackEvent', 'Outgoing', 'click', '/outgoing/http_www_game_advertising_online_com_']);" rel="nofollow" href="http://www.game-advertising-online.com/" target=_blank>Game Advertising Online</a><br> banner requires iframes

Old 02-25-2009   #4 (permalink)
So Long, Good-Bye
 
RastaLulz's Avatar


Rank: Hobbit
Join Date: Dec 2007
Location: America
Posts: 3,575
Thanked 206 Times in 50 Posts

Re: [PHP/OOP] 4chan image downloader V2

EDIT:
I get this error (cut most of it out, as it just keeps going):
Spoiler:

Warning: fopen(http://forum.ragezone.com/images/1231557360.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fopen(http://forum.ragezone.com/images/1057467094.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/155272629.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1302480645.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/313769124.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1284281773.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1224554075.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/803840865.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/183298859.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/620502664.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/827122343.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1144948452.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/447014245.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/228927755.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/957838674.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1240111155.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/373707797.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/458845759.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1027499656.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/771991171.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/525457841.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/545948870.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/952255751.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/946560081.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/885259376.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1241851128.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1075727281.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/597348005.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/100885000.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/485501204.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/894793242.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/149357804.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/441168312.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1210086757.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1201313926.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/930353098.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/705887364.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/353684963.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1080417580.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/494662297.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/114535030.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/533831215.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/960195144.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/411181887.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/673270827.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/289079470.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/514106299.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/845810821.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/781306574.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/408946110.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1295449843.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1029980198.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/481323632.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/675401954.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/285130141.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/993384451.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/570665700.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/838556004.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/9635530.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1298209213.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/204853762.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1232885278.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/360016702.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/84661853.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/207734052.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1036704544.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/404250197.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1269059853.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/914622255.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/119300948.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/323280556.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/328548306.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/469745044.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/1166790340.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/177173665.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/970125418.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/810317116.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/918153208.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/116220436.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/170772757.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/946784065.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/109741947.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/52495455.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76

Warning: fopen(http://forum.ragezone.com/images/160563504.jpg) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 74

Warning: fclose(): 2 is not a valid stream resource in /home/rasta21/public_html/foskett.ws/4chan/4chan_images.php on line 76


I've tried it on localhost, and my webhost, neither work.
__________________
Looking for something? Use the Search Button, and be self productive.

New to the forums? Take a look at the following links: Global Forum Rules | Habbo Hotel Rules



Watch the following videos: RLulzUsersystem - Preview (#1) | Zeitgeist: Addendum

My Groups
: American RaGEZONERS | Jailbait
RastaLulz is offline   Reply With Quote
Old 02-26-2009   #5 (permalink)
Account Upgraded | Title Enabled!


Rank: Member +
Join Date: Apr 2007
Posts: 902
Thanked 5 Times in 3 Posts

Re: [PHP/OOP] 4chan image downloader V2

It's very nice.

I got the same error as you, Rasta. I can't remember exactly how I fixed it but it had something to do with PHP permissions... Either that or I installed another webserver software, WAMP that is.
Mr.Lucifer is offline   Reply With Quote
Old 02-26-2009   #6 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Rasta View Post
EDIT:
I get this error (cut most of it out, as it just keeps going):

I've tried it on localhost, and my webhost, neither work.
It seems php can't open the folder where the images are saved in. Try to chmod the folder to 777. If that doesn't work change
PHP Code:
while(($handle_internal fopen("http://forum.ragezone.com/images/".rand(0000000000001,9999999999999).".$extension""x+"))== false
on line 74 to
PHP Code:
while(($handle_internal fopen("".rand(0000000000001,9999999999999).".$extension""x+"))== false
This will save all the images in the same folder as the script is located.

As Mr. Lucifer said, it has to do something with permissions. I'm unsure how to fix it though, other than the methods I named above.
__________________
Pieman is offline   Reply With Quote
Old 02-26-2009   #7 (permalink)
So Long, Good-Bye
 
RastaLulz's Avatar


Rank: Hobbit
Join Date: Dec 2007
Location: America
Posts: 3,575
Thanked 206 Times in 50 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Pieman View Post
It seems php can't open the folder where the images are saved in. Try to chmod the folder to 777. If that doesn't work change
PHP Code:
while(($handle_internal fopen("http://forum.ragezone.com/images/".rand(0000000000001,9999999999999).".$extension""x+"))== false
on line 74 to
PHP Code:
while(($handle_internal fopen("".rand(0000000000001,9999999999999).".$extension""x+"))== false
This will save all the images in the same folder as the script is located.

As Mr. Lucifer said, it has to do something with permissions. I'm unsure how to fix it though, other than the methods I named above.
Thanks, it now works perfectly.

Also, when I tried to chmod it to 777 yesterday, it gave me the 500 error.

But anyways, that fix worked.
__________________
Looking for something? Use the Search Button, and be self productive.

New to the forums? Take a look at the following links: Global Forum Rules | Habbo Hotel Rules



Watch the following videos: RLulzUsersystem - Preview (#1) | Zeitgeist: Addendum

My Groups
: American RaGEZONERS | Jailbait
RastaLulz is offline   Reply With Quote
Old 02-26-2009   #8 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Rasta View Post
Thanks, it now works perfectly.

Also, when I tried to chmod it to 777 yesterday, it gave me the 500 error.

But anyways, that fix worked.
Glad to help
__________________
Pieman is offline   Reply With Quote
Old 03-21-2009   #9 (permalink)
Don't you mean Bizzarro!
 
Ambrosiax's Avatar


Rank: Member +
Join Date: Apr 2008
Posts: 1,344
Thanked 0 Times in 0 Posts

Re: [PHP/OOP] 4chan image downloader V2

This is probably a small problem I keep getting.

Code:
Notice: Undefined variable: i in C:\wamp\www\IMAGES\4chan_images.php on line 23

Notice: Undefined variable: images_array in C:\wamp\www\IMAGES\4chan_images.php on line 31
0 image(s) not saved.
Whats that mean?
Theres no images? o.O
__________________
Ambrosiax is offline   Reply With Quote
Old 03-25-2009   #10 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Ambrosiax View Post
This is probably a small problem I keep getting.

Code:
Notice: Undefined variable: i in C:\wamp\www\IMAGES\4chan_images.php on line 23

Notice: Undefined variable: images_array in C:\wamp\www\IMAGES\4chan_images.php on line 31
0 image(s) not saved.
Whats that mean?
Theres no images? o.O
It's just an empty variable. Just add error_reporting(1); add the top of the file and it should be fixed.

Or better yet, add
PHP Code:
 $i 0
under
PHP Code:
$source $this->get_source(); 
On line 19.
__________________
Pieman is offline   Reply With Quote
Old 03-25-2009   #11 (permalink)
2009 THE PINK IS IN!
 
john_d's Avatar


Rank: Alpha Member
Join Date: Feb 2004
Location: Philippines
Posts: 2,970
Thanked 55 Times in 23 Posts

Re: [PHP/OOP] 4chan image downloader V2

im more interested in a CSS image downloader
__________________
Dekaron UI v2 | Maple Portal | MUToolz Multi Server Edition | CabalToolz V4

On Twitter "http://twitter.com/mmowebs"
Portfolio: http://www.mmowebs.com/
john_d is offline   Reply With Quote
Old 03-25-2009   #12 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by john_d View Post
im more interested in a CSS image downloader
Like a script that downloads all images from a CSS file? That does sound useful indeed... Maybe an idea for my next project.
__________________
Pieman is offline   Reply With Quote
Old 03-26-2009   #13 (permalink)
I Am.
 
s-p-n's Avatar


Rank: Hobbit
Join Date: Jun 2007
Location: Daevius' Belly
Posts: 1,139
Thanked 32 Times in 15 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Pieman View Post
It seems php can't open the folder where the images are saved in. Try to chmod the folder to 777. If that doesn't work change
PHP Code:
while(($handle_internal fopen("http://forum.ragezone.com/images/".rand(0000000000001,9999999999999).".$extension""x+"))== false
on line 74 to
PHP Code:
while(($handle_internal fopen("".rand(0000000000001,9999999999999).".$extension""x+"))== false
This will save all the images in the same folder as the script is located.

As Mr. Lucifer said, it has to do something with permissions. I'm unsure how to fix it though, other than the methods I named above.
Actually it's because it says http://forum.ragezone.com/images/ instead of ./images.

If you just replaced the http://forum.ragezone.com part with a [.] it should be fine.

Ragezone glitch hurts sometimes
__________________
Take this bait; Take this fishing line, here. Go catch yourself a fish. Listen, and catch a REALLY BIG fish.

-------------------------------------
Originally Posted by Sir Henry Wootton
"i pensieri stretti & il viso sciolto." Closed thoughts and an open face. Smile at everyone, and don't tell them what you're thinking.
From, What You Can't Say
s-p-n is offline   Reply With Quote
Old 03-26-2009   #14 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by s-p-n View Post
Actually it's because it says http://forum.ragezone.com/images/ instead of ./images.

If you just replaced the http://forum.ragezone.com part with a [.] it should be fine.

Ragezone glitch hurts sometimes
That glitch is dreadfully annoying yes, though I believe the poster was aware of this.
__________________
Pieman is offline   Reply With Quote
Old 07-07-2009   #15 (permalink)
Isenheart .
 
Leimone's Avatar


Rank: Member +
Join Date: Jul 2008
Location: Sweden, Stockholm.
Posts: 1,399
Thanked 0 Times in 0 Posts

Re: [PHP/OOP] 4chan image downloader V2

Goodjob, thanks.
Leimone is offline   Reply With Quote
Old 07-13-2009   #16 (permalink)
So Long, Good-Bye
 
RastaLulz's Avatar


Rank: Hobbit
Join Date: Dec 2007
Location: America
Posts: 3,575
Thanked 206 Times in 50 Posts

Re: [PHP/OOP] 4chan image downloader V2

The script no longer works for me..
http://foskett.ws/4chan/4chan_images.php
__________________
Looking for something? Use the Search Button, and be self productive.

New to the forums? Take a look at the following links: Global Forum Rules | Habbo Hotel Rules



Watch the following videos: RLulzUsersystem - Preview (#1) | Zeitgeist: Addendum

My Groups
: American RaGEZONERS | Jailbait
RastaLulz is offline   Reply With Quote
Old 08-05-2009   #17 (permalink)
Ultimate Member
 
Carter's Avatar


Rank: Member
Join Date: Jul 2008
Posts: 150
Thanked 3 Times in 3 Posts

Re: [PHP/OOP] 4chan image downloader V2

Rasta your script works fine :)

idk whats up with mine though.

I've edited everything i need to but check it out:

http://rapidwind.net/4chan/4chan.php

When you enter the URL of the thread it doesn't show any pictures it only shows the download button.

here is what I have in the script:

(File permissions are at 755)

PHP Code:
<?php 
class image_downloader {  

    public 
$url
     
    protected function 
get_source() { 
     
        if((
$source = @file_get_contents($this->url)) == false) { 
         
            die(
"Could not open thread."); 
         
        } 
     
        return 
$source
    } 
     
    protected function 
get_file_link() { 
     
        
$source $this->get_source(); 
             
        
preg_match_all("/File :(.*?)\<blockquote\>/is"$source$matches_image); 
         
        while(
$i count($matches_image[1])) { 
         
            
preg_match("/\<a href\=\\\"(.*?)\\\" target\=/is"$matches_image[0][$i], $images_array[$i]); 
                     
            
$i ++; 
             
        } 
                     
        return 
$images_array
                 
    } 
     
    public function 
get_images() { 
     
        
$a_images $_POST['amount']; 
        
$i 1
         
        while(
$i $a_images) {  
         
            if(isset(
$_POST["image_$i"])) { 
             
                
$images_array[$i] .= $_POST["image_$i"]; 
                 
            } 
             
            
$i ++; 
             
        } 
         
        return 
$images_array
         
    } 
     
    public function 
save_file() { 
     
        
$images_array $this->get_images(); 
        
$i 1
        
$errors 0
         
        while(
$i count($images_array)) { 
         
            
$extension preg_replace("/.*\./is"""$images_array[$i]); 
     
            if((
$handle_external = @fopen($images_array[$i], "r"))) { 
             
                while(
$line fread($handle_external8192)) { 
                 
                    
$file .= $line
                     
                } 
                
//Change the directory between quotes to change the directory the image will be downloaded to. 
                
while(($handle_internal fopen("./images".rand(0000000000001,9999999999999).".$extension""x+"))== false
                 
                
fclose($handle_external); 
                
fwrite($handle_internal$file); 
                
fclose($handle_internal); 
                unset(
$handle_external$line$file$handle_internal); 
                 
            } else { 
             
                
$errors ++; 
                 
            } 
             
            
$i ++; 
             
        } 
             
        echo 
$errors " image(s) not saved.<br/><br/><a href='".$_SERVER['PHP_SELF']."'>&lt;&lt;back</a>"
         
    }                 

class 
display_images extends image_downloader 

    public 
$url

    private function 
get_thumbs() { 
     
        
$source $this->get_source(); 
             
        
preg_match_all("/File :(.*?)\<blockquote\>/is"$source$matches_image); 
         
        while(
$i count($matches_image[1])) { 
         
            
preg_match("/img src=([a-z0-9:\/\.]*)/is"$matches_image[0][$i], $thumbs_array[$i]); 
                     
            
$i ++; 
             
        } 
                     
        return 
$thumbs_array
                 
    } 
     
    public function 
d_img_form() { 
     
        
$thumbs_array $this->get_thumbs(); 
        
$images_array $this->get_file_link(); 
        
$i 1
         
        echo 
'<form name="image_form" method="post" action="4chan.php">'
        echo 
"\n"
        echo 
'<table cellspacing ="5" border ="0" align="center">'
        echo 
"\n"
         
        while(
$i count($thumbs_array)) { 
         
            
$thumbs .= "<td><div style='width:130px; height:130px; background-color:#000000;' align='center'><input type='checkbox' checked='checked' name='image_$i' value='".$images_array[$i][1]."' style='float:right;'/><a href='".$images_array[$i][1]."' target='_blank'><img src='".$thumbs_array[$i][1]."' alt='Thumbnail $i' style='max-height:115px;' border='0'/></a></div></td>\n"
                     
            if((
$i $_POST['images_row'] == 0) || (count($thumbs_array) - $i == 1)) { 
                 
                echo 
"<tr>\n"
                echo 
$thumbs
                echo 
"</tr>\n"
                             
                unset(
$thumbs); 
            } 
             
            
$i ++; 
             
        } 
         
        echo 
"</table>"
        echo 
"<input type='hidden' name='amount' value='".count($thumbs_array)."'/>"
        echo 
"\n <br/> \n"
        echo 
'<div align="center"><input type="submit" name="download" value="download"/></div>'
        echo 
'</form>'
             
    } 
}         
     
set_time_limit(0); 
ini_set("max_execution_time""0"); 

if(!isset(
$_POST['get_thread']) && !isset($_POST['download'])) { 

    
?> 
    <form method="post" action="<?=$_SERVER['PHP_SELF'];?>"> 
    Link to thread:<br/> 
    <input type="text" size="55" name="link" /> 
    <br/> 
    Amount of images per row 
    <select name="images_row"> 
    <option value="10">10</option> 
    <option value="9">9</option> 
    <option value="8">8</option> 
    <option value="7">7</option> 
    <option value="6">6</option> 
    <option value="5">5</option> 
    <option value="4">4</option> 
    <option value="3">3</option> 
    <option value="2">2</option> 
    <option value="1">1</option> 
    </select> 
    <br/> 
    <input type="submit" value="submit" name="get_thread" /> 
    </form> 
    <?php 
     
} else if(!isset($_POST['download'])) { 

    
$display = new display_images(); 
    
$display -> url $_POST['link']; 
    
$display -> d_img_form();  
     
} else { 

    
$downloader = new image_downloader(); 
    
$downloader -> save_file();  


?>
__________________
Originally Posted by holthelper View Post
yes most computers are 32 bit aka system32 not system64 (if you know what im talking about) im not sure as to how to get a 64 bit.

Last edited by Carter; 08-05-2009 at 02:13 AM.
Carter is offline   Reply With Quote
Old 08-05-2009   #18 (permalink)
So Long, Good-Bye
 
RastaLulz's Avatar


Rank: Hobbit
Join Date: Dec 2007
Location: America
Posts: 3,575
Thanked 206 Times in 50 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Carter View Post
Rasta your script works fine :)

idk whats up with mine though.

I've edited everything i need to but check it out:

http://rapidwind.net/4chan/4chan.php

When you enter the URL of the thread it doesn't show any pictures it only shows the download button.

here is what I have in the script:

(File permissions are at 755)

PHP Code:
<?php 
class image_downloader {  

    public 
$url
     
    protected function 
get_source() { 
     
        if((
$source = @file_get_contents($this->url)) == false) { 
         
            die(
"Could not open thread."); 
         
        } 
     
        return 
$source
    } 
     
    protected function 
get_file_link() { 
     
        
$source $this->get_source(); 
             
        
preg_match_all("/File :(.*?)\<blockquote\>/is"$source$matches_image); 
         
        while(
$i count($matches_image[1])) { 
         
            
preg_match("/\<a href\=\\\"(.*?)\\\" target\=/is"$matches_image[0][$i], $images_array[$i]); 
                     
            
$i ++; 
             
        } 
                     
        return 
$images_array
                 
    } 
     
    public function 
get_images() { 
     
        
$a_images $_POST['amount']; 
        
$i 1
         
        while(
$i $a_images) {  
         
            if(isset(
$_POST["image_$i"])) { 
             
                
$images_array[$i] .= $_POST["image_$i"]; 
                 
            } 
             
            
$i ++; 
             
        } 
         
        return 
$images_array
         
    } 
     
    public function 
save_file() { 
     
        
$images_array $this->get_images(); 
        
$i 1
        
$errors 0
         
        while(
$i count($images_array)) { 
         
            
$extension preg_replace("/.*\./is"""$images_array[$i]); 
     
            if((
$handle_external = @fopen($images_array[$i], "r"))) { 
             
                while(
$line fread($handle_external8192)) { 
                 
                    
$file .= $line
                     
                } 
                
//Change the directory between quotes to change the directory the image will be downloaded to. 
                
while(($handle_internal fopen("./images".rand(0000000000001,9999999999999).".$extension""x+"))== false
                 
                
fclose($handle_external); 
                
fwrite($handle_internal$file); 
                
fclose($handle_internal); 
                unset(
$handle_external$line$file$handle_internal); 
                 
            } else { 
             
                
$errors ++; 
                 
            } 
             
            
$i ++; 
             
        } 
             
        echo 
$errors " image(s) not saved.<br/><br/><a href='".$_SERVER['PHP_SELF']."'>&lt;&lt;back</a>"
         
    }                 

class 
display_images extends image_downloader 

    public 
$url

    private function 
get_thumbs() { 
     
        
$source $this->get_source(); 
             
        
preg_match_all("/File :(.*?)\<blockquote\>/is"$source$matches_image); 
         
        while(
$i count($matches_image[1])) { 
         
            
preg_match("/img src=([a-z0-9:\/\.]*)/is"$matches_image[0][$i], $thumbs_array[$i]); 
                     
            
$i ++; 
             
        } 
                     
        return 
$thumbs_array
                 
    } 
     
    public function 
d_img_form() { 
     
        
$thumbs_array $this->get_thumbs(); 
        
$images_array $this->get_file_link(); 
        
$i 1
         
        echo 
'<form name="image_form" method="post" action="4chan.php">'
        echo 
"\n"
        echo 
'<table cellspacing ="5" border ="0" align="center">'
        echo 
"\n"
         
        while(
$i count($thumbs_array)) { 
         
            
$thumbs .= "<td><div style='width:130px; height:130px; background-color:#000000;' align='center'><input type='checkbox' checked='checked' name='image_$i' value='".$images_array[$i][1]."' style='float:right;'/><a href='".$images_array[$i][1]."' target='_blank'><img src='".$thumbs_array[$i][1]."' alt='Thumbnail $i' style='max-height:115px;' border='0'/></a></div></td>\n"
                     
            if((
$i $_POST['images_row'] == 0) || (count($thumbs_array) - $i == 1)) { 
                 
                echo 
"<tr>\n"
                echo 
$thumbs
                echo 
"</tr>\n"
                             
                unset(
$thumbs); 
            } 
             
            
$i ++; 
             
        } 
         
        echo 
"</table>"
        echo 
"<input type='hidden' name='amount' value='".count($thumbs_array)."'/>"
        echo 
"\n <br/> \n"
        echo 
'<div align="center"><input type="submit" name="download" value="download"/></div>'
        echo 
'</form>'
             
    } 
}         
     
set_time_limit(0); 
ini_set("max_execution_time""0"); 

if(!isset(
$_POST['get_thread']) && !isset($_POST['download'])) { 

    
?> 
    <form method="post" action="<?=$_SERVER['PHP_SELF'];?>"> 
    Link to thread:<br/> 
    <input type="text" size="55" name="link" /> 
    <br/> 
    Amount of images per row 
    <select name="images_row"> 
    <option value="10">10</option> 
    <option value="9">9</option> 
    <option value="8">8</option> 
    <option value="7">7</option> 
    <option value="6">6</option> 
    <option value="5">5</option> 
    <option value="4">4</option> 
    <option value="3">3</option> 
    <option value="2">2</option> 
    <option value="1">1</option> 
    </select> 
    <br/> 
    <input type="submit" value="submit" name="get_thread" /> 
    </form> 
    <?php 
     
} else if(!isset($_POST['download'])) { 

    
$display = new display_images(); 
    
$display -> url $_POST['link']; 
    
$display -> d_img_form();  
     
} else { 

    
$downloader = new image_downloader(); 
    
$downloader -> save_file();  


?>
Yes, mine has the same error.
__________________
Looking for something? Use the Search Button, and be self productive.

New to the forums? Take a look at the following links: Global Forum Rules | Habbo Hotel Rules



Watch the following videos: RLulzUsersystem - Preview (#1) | Zeitgeist: Addendum

My Groups
: American RaGEZONERS | Jailbait
RastaLulz is offline   Reply With Quote
Old 08-05-2009   #19 (permalink)
Ultimate Member
 
Carter's Avatar


Rank: Member
Join Date: Jul 2008
Posts: 150
Thanked 3 Times in 3 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Rasta View Post
Yes, mine has the same error.
That's weird lol, when i go on yours it works for me..
__________________
Originally Posted by holthelper View Post
yes most computers are 32 bit aka system32 not system64 (if you know what im talking about) im not sure as to how to get a 64 bit.
Carter is offline   Reply With Quote
Old 08-09-2009   #20 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

I think 4chan changed it's source code around a bit because the script doesn't seem to work anymore. I'll try to fix it as soon as possible.
__________________
Pieman is offline   Reply With Quote
Thanked by :
Old 08-12-2009   #21 (permalink)
So Long, Good-Bye
 
RastaLulz's Avatar


Rank: Hobbit
Join Date: Dec 2007
Location: America
Posts: 3,575
Thanked 206 Times in 50 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by Pieman View Post
I think 4chan changed it's source code around a bit because the script doesn't seem to work anymore. I'll try to fix it as soon as possible.
That would be very much appreciated, as it's alot easier than saving every image one by one.
__________________
Looking for something? Use the Search Button, and be self productive.

New to the forums? Take a look at the following links: Global Forum Rules | Habbo Hotel Rules



Watch the following videos: RLulzUsersystem - Preview (#1) | Zeitgeist: Addendum

My Groups
: American RaGEZONERS | Jailbait
RastaLulz is offline   Reply With Quote
Old 08-12-2009   #22 (permalink)
:)


Rank: Alpha Member
Join Date: Jan 2009
Location: Illinois, U.S.
Posts: 2,496
Thanked 138 Times in 47 Posts

Re: [PHP/OOP] 4chan image downloader V2

Yea, I noticed this didn't work a while ago. I'll probably try fixing it later.
__________________
Horizon is offline   Reply With Quote
Old 10-10-2009   #23 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Updated the first post with the new script. Everything is working as it should now.
__________________
Pieman is offline   Reply With Quote
Old 01-15-2010   #24 (permalink)
Newbie


Rank: Hobbit
Join Date: Jan 2010
Posts: 1
Thanked 0 Times in 0 Posts

Re: [PHP/OOP] 4chan image downloader V2

I keep getting 0 image(s) was downloaded even though it displays the images and I check them and everything.

The image link is correct and I have tried everything from an abolute path, to a local path.

Okay scratch that I got it working, any way for this to work after you close the window? That way I don't have to wait indefinitely?

Perhaps integrate http://www.phpclasses.org/browse/package/1277.html a process queue?

Last edited by TeamColtra; 01-15-2010 at 01:26 PM.
TeamColtra is offline   Reply With Quote
Old 01-15-2010   #25 (permalink)
Fuck you, I'm a dragon
 
Pieman's Avatar


Rank: Moderator
Join Date: Apr 2005
Location: The Netherlands
Posts: 7,471
Thanked 21 Times in 8 Posts

Re: [PHP/OOP] 4chan image downloader V2

Originally Posted by TeamColtra View Post
I keep getting 0 image(s) was downloaded even though it displays the images and I check them and everything.

The image link is correct and I have tried everything from an abolute path, to a local path.

Okay scratch that I got it working, any way for this to work after you close the window? That way I don't have to wait indefinitely?

Perhaps integrate http://www.phpclasses.org/browse/package/1277.html a process queue?
After you press submit, you can close the window and the script will keep running on your web server.
__________________
Pieman is offline   Reply With Quote
 

Bookmarks

Thread Tools




no new posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291