[prev in list] [next in list] [prev in thread] [next in thread]
List: gollem
Subject: Re: [gollem] Multiple downloads / ZIP |GZIP Archive?
From: Mike Cochrane <mike () graftonhall ! co ! nz>
Date: 2003-07-02 1:24:30
Message-ID: 1057109070.ae058b4e8ea20 () clean ! graftonhall ! co ! nz
[Download RAW message or body]
> ----- Message from chuck@horde.org ---------
>
> There are a couple of tools in PHP - at least Archive_Tar in PEAR - for
> creating archives. It'd be great to get a patch to do this.
>
> -chuck
>
> --
> Charles Hagenbuch, <chuck@horde.org>
> The alligators were there, too, in a bathtub inside the house.
Here is some code that I use on another project to zip files:
// compress file to zip
require_once HORDE_BASE . '/lib/Compress.php';
$zip = &Horde_Compress::singleton('zip');
$files[] = array('name' => $filename,
'data' => $file_data);
$output_zip_data = $zip->compress($files);
$fp = fopen($output_zip_filename, 'wb');
fwrite($fp, $output_zip_data);
fclose($fp);
Also for bz and gz files:
// compess file to bz2
$fp = fopen($output_bz2_filename, 'wb');
fwrite($fp, bzcompress($file_data, 9));
fclose($fp);
// compress file to gz
$fp = fopen($output_gz_filename, 'wb');
fwrite($fp, gzdeflate($file_data, 9));
fclose($fp);
To use these, you will need to create the Tar file first and then bz or gz them.
- Mike :-)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic