public function pack($from, $to)
    {
        if (($gzip = gzopen($to, 'wb')) === false) {
            throw new Exception('Unable create compressed file.');
        }

        if (($source = fopen($from, 'rb')) === false) {
            throw new Exception('Unable open the compression source file.');
        }

        while (!feof($source)) {
            $content = fread($source, 4096);
            gzwrite($gzip, $content, strlen($content));
        }

        gzclose($gzip);
        fclose($source);
    }
public function pack($from, $to)
    {
        if (($gzip = gzopen($to, 'wb')) === false) {
            throw new Exception('Unable create compressed file.');
        }

        if (($source = fopen($from, 'rb')) === false) {
            throw new Exception('Unable open the compression source file.');
        }

        while (!feof($source)) {
            $content = fread($source, 4096);
            gzwrite($gzip, $content, strlen($content));
        }

        gzclose($gzip);
        fclose($source);
    }
public function pack ( $ from , $ to ) { if ( ( $ gzip = gzopen ( $ to , 'wb' ) ) === false ) { throw new Exception ( 'Unable create compressed file.' ) ; } if ( ( $ source = fopen ( $ from , 'rb' ) ) === false ) { throw new Exception ( 'Unable open the compression source file.' ) ; } while ( ! feof ( $ source ) ) { $ content = fread ( $ source , 4096 ) ; gzwrite ( $ gzip , $ content , strlen ( $ content ) ) ; } gzclose ( $ gzip ) ; fclose ( $ source ) ; }
Compresses a file.

@param  string $from The source
@param  string $to   The target
@throws Exception
Compresses a file .