Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Zlib Compression Functions : gztell

gztell

Tell gz-file pointer read/write position (PHP 4, PHP 5)
int gztell ( resource zp )


Code Examples / Notes » gztell

steve ramage

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)."
\n";
gzclose($gz_fp);
echo "filesize = ".filesize('some_file.sql.gz')."
\n";
?>
Output:
gztell = 2048000
filesize = 249264
I will report this as a bug but post a note here for now


Change Language


Follow Navioo On Twitter
gzclose
gzcompress
gzdecode
gzdeflate
gzencode
gzeof
gzfile
gzgetc
gzgets
gzgetss
gzinflate
gzopen
gzpassthru
gzputs
gzread
gzrewind
gzseek
gztell
gzuncompress
gzwrite
readgzfile
zlib_get_coding_type
eXTReMe Tracker