Results 1 to 4 of 4

Thread: compress multiple files with Zlib [*RESOLVED*]

Threaded View

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    compress multiple files with Zlib [*RESOLVED*]

    Hey im am trying to compress multiple files using zlib but im not having any luck. I can compress single files but i cant find out how to create a table of contents for the .GZ file.

    I read that the files need to be read into an array than imploded by then " character then written to the file. It didnt work?

    Here is my code
    PHP Code:
    <?
    $files = array(
                    "test.jpg",
                    "test.png",
                    "test.php"
                    );
    foreach($files as $file){
        $temp = null;
        $fp_in = fopen($file,'rb');
        print "--opening \"$file\" for reading<br>";
        while(!feof($fp_in)){
            $temp .= fread($fp_in,1024);
        }
        $output[$file] = $temp;
        fclose($fp_in);
        print "--closing \"$file\"<br>";
    }

    $output = implode('"',$output);

    $fp = gzopen("output.gz","wb");
    print "opening \"output.gz\"<br>";
    gzputs($fp,$ouput);
    gzclose($fp);
    print "closing \"output.gz\"";
    ?>
    Last edited by john tindell; Aug 14th, 2004 at 08:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width