PHP 5.6.0 released

gztell

(PHP 4, PHP 5)

gztellTell gz-file pointer read/write position

Descrierea

int gztell ( resource $zp )

Gets the position of the given file pointer; i.e., its offset into the uncompressed file stream.

Parametri

zp

The gz-file pointer. It must be valid, and must point to a file successfully opened by gzopen().

Valorile întoarse

The position of the file pointer or FALSE if an error occurs.

Vedeți de asemenea

add a note add a note

User Contributed Notes 1 note

up
0
Steve Ramage
7 years ago
ok so this function returns the gz file pointer as the uncompressed data byte length so if you are trying to put something in to specific size gzip files it won't work.

Example:

<?
//some_file.sql  filesize = 2,048,000 bytes

$text_fp=fopen('some_file.sql','r');
$gz_fp=gzopen('some_file.sql.gz','wb9');
while(!feof($text_fp)){
    gzwrite($gz_fp,fread($text_fp,655360));
}
fclose($text_fp);
echo "gztell = ".gztell($gz_fp)."<BR>\n";
gzclose($gz_fp);
echo "filesize = ".filesize('some_file.sql.gz')."<BR>\n";
?>

Output:

gztell = 2048000
filesize = 249264

I will report this as a bug but post a note here for now
To Top