Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-14 Thread Bob Sabiston
That isn't going to work.   Gzip is used for entire files.  Do you  
understand what I'm trying to do, or am I misunderstanding you?

Bob


On Dec 13, 2007, at 11:13 PM, Casey wrote:


On Dec 13, 2007 7:44 AM, Bob Sabiston [EMAIL PROTECTED] wrote:


On Dec 12, 2007, at 7:20 PM, Casey wrote:


Try gzuncompress();


Correct me if I'm wrong, but isn't gzuncompress used for 'gzip'
files?  Although they both use the same compression, gzip is specific
to files and has header information not present in straight zlib
data.  And as I've mentioned, this is a normal file, not compressed  
--
I'm just trying to read and decompress pieces of data within the  
file,

which according to the documentation is something zlib does.

I assume that most people use these functions for entire files, but
surely someone has used it the other way as well?

Thanks for any info.
Bob





Zlib compression is what's used in Gzip. Just try it ;)

$uncompressed = gzuncompress(file_get_contents(binaryfile.ext));

-Casey


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-14 Thread Bob Sabiston


Revisiting the Zlib PHP html page, I notice that it says that Zlib in  
PHP works with uncompressed files, but not with sockets.  Could that  
be my problem?  What does it mean to be using sockets?  I'm sending  
this data wirelessly from a handheld device to a server, and I'm using  
the device API, it might use sockets to connect.  If that is  
preventing Zlib from working, is there any way around that?


Could the problem be that I am using the zLib functions on the file  
pointer obtained in this way:


$headerfile = $_FILES['header']['tmp_name'];

Is that not a real file or something? Would it work perhaps if I first  
moved this above file to another place within my directories?  I think  
that $_FILES thing references a temporary file.


Sorry if that's a newbie question, I am coming from a C/C++ background  
and still getting used to $variables having 'fuzzy' types.


Thanks,

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-14 Thread Bob Sabiston



Zlib compression is what's used in Gzip. Just try it ;)

$uncompressed = gzuncompress(file_get_contents(binaryfile.ext));

-Casey




On Dec 14, 2007, at 9:45 AM, Bob Sabiston wrote:

That isn't going to work.   Gzip is used for entire files.  Do you  
understand what I'm trying to do, or am I misunderstanding you?


Bob


Oops -- I'm so sorry!  I was wrong thinking that it operated on files.  
I'd been reading so much about the file format and how gzip meant  
files and zlib meant the core data.  I just assumed gzuncompress would  
be a file thing.


I should be able to get that to work, thank you.

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-13 Thread Bob Sabiston


On Dec 12, 2007, at 7:20 PM, Casey wrote:


Try gzuncompress();


Correct me if I'm wrong, but isn't gzuncompress used for 'gzip'  
files?  Although they both use the same compression, gzip is specific  
to files and has header information not present in straight zlib  
data.  And as I've mentioned, this is a normal file, not compressed --  
I'm just trying to read and decompress pieces of data within the file,  
which according to the documentation is something zlib does.


I assume that most people use these functions for entire files, but  
surely someone has used it the other way as well?


Thanks for any info.
Bob






On Dec 12, 2007, at 1:03 PM, Bob Sabiston [EMAIL PROTECTED]  
wrote:




On Dec 12, 2007, at 2:31 PM, Richard Lynch wrote:


On Wed, December 12, 2007 11:28 am, Bob Sabiston wrote:

I'm trying to read some zlib-compressed data from a regular binary
file.  When I try to attach the zlib compression filter, I am  
getting
an error:  something about how the prebuffered data didn't work  
with

the filter and so the filter wasn't added to the filter chain.


I looked and found a way to turn off buffering for stream *writes*,
but not for stream reads.  Can anyone help with ideas for why this
isn't working?  I posted questions to comp.lang.php and received no
response.


If all else fails, you could just not use the fancy-pants new stream
and filter functions, and just use http://php.net/zlib directly on  
the

file.
Sorry Richard for the double mail, I didn't have the list cc'd  
before...


How could I do that?  I thought the only way to use zlib in PHP was  
through the stream functions.





It's also possible your zlib file is just plain corrupt, and neither
will work...


But I am getting the error before I start to read -- it is not a  
zlib 'file', it is a stretch of data within

an ordinary file that has been compressed with zlib.

Thanks
Bob


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-13 Thread Casey
On Dec 13, 2007 7:44 AM, Bob Sabiston [EMAIL PROTECTED] wrote:

 On Dec 12, 2007, at 7:20 PM, Casey wrote:

  Try gzuncompress();

 Correct me if I'm wrong, but isn't gzuncompress used for 'gzip'
 files?  Although they both use the same compression, gzip is specific
 to files and has header information not present in straight zlib
 data.  And as I've mentioned, this is a normal file, not compressed --
 I'm just trying to read and decompress pieces of data within the file,
 which according to the documentation is something zlib does.

 I assume that most people use these functions for entire files, but
 surely someone has used it the other way as well?

 Thanks for any info.
 Bob




Zlib compression is what's used in Gzip. Just try it ;)

$uncompressed = gzuncompress(file_get_contents(binaryfile.ext));

-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-12 Thread Bob Sabiston

Hello,

  I'm trying to read some zlib-compressed data from a regular binary  
file.  When I try to attach the zlib compression filter, I am getting  
an error:  something about how the prebuffered data didn't work with  
the filter and so the filter wasn't added to the filter chain.



I looked and found a way to turn off buffering for stream *writes*,  
but not for stream reads.  Can anyone help with ideas for why this  
isn't working?  I posted questions to comp.lang.php and received no  
response.


Thanks
Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-12 Thread Richard Lynch
On Wed, December 12, 2007 11:28 am, Bob Sabiston wrote:
I'm trying to read some zlib-compressed data from a regular binary
 file.  When I try to attach the zlib compression filter, I am getting
 an error:  something about how the prebuffered data didn't work with
 the filter and so the filter wasn't added to the filter chain.


 I looked and found a way to turn off buffering for stream *writes*,
 but not for stream reads.  Can anyone help with ideas for why this
 isn't working?  I posted questions to comp.lang.php and received no
 response.

If all else fails, you could just not use the fancy-pants new stream
and filter functions, and just use http://php.net/zlib directly on the
file.

It's also possible your zlib file is just plain corrupt, and neither
will work...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-12 Thread Bob Sabiston


On Dec 12, 2007, at 2:31 PM, Richard Lynch wrote:


On Wed, December 12, 2007 11:28 am, Bob Sabiston wrote:

 I'm trying to read some zlib-compressed data from a regular binary
file.  When I try to attach the zlib compression filter, I am getting
an error:  something about how the prebuffered data didn't work with
the filter and so the filter wasn't added to the filter chain.


I looked and found a way to turn off buffering for stream *writes*,
but not for stream reads.  Can anyone help with ideas for why this
isn't working?  I posted questions to comp.lang.php and received no
response.


If all else fails, you could just not use the fancy-pants new stream
and filter functions, and just use http://php.net/zlib directly on the
file.

Sorry Richard for the double mail, I didn't have the list cc'd before...

How could I do that?  I thought the only way to use zlib in PHP was  
through the stream functions.





It's also possible your zlib file is just plain corrupt, and neither
will work...


But I am getting the error before I start to read -- it is not a zlib  
'file', it is a stretch of data within

an ordinary file that has been compressed with zlib.

Thanks
Bob


Re: [PHP] zlib and fopen and stream_filter_append, prebuffer read errors help

2007-12-12 Thread Casey

Try gzuncompress();



On Dec 12, 2007, at 1:03 PM, Bob Sabiston [EMAIL PROTECTED]  
wrote:




On Dec 12, 2007, at 2:31 PM, Richard Lynch wrote:


On Wed, December 12, 2007 11:28 am, Bob Sabiston wrote:

I'm trying to read some zlib-compressed data from a regular binary
file.  When I try to attach the zlib compression filter, I am  
getting

an error:  something about how the prebuffered data didn't work with
the filter and so the filter wasn't added to the filter chain.


I looked and found a way to turn off buffering for stream *writes*,
but not for stream reads.  Can anyone help with ideas for why this
isn't working?  I posted questions to comp.lang.php and received no
response.


If all else fails, you could just not use the fancy-pants new stream
and filter functions, and just use http://php.net/zlib directly on  
the

file.
Sorry Richard for the double mail, I didn't have the list cc'd  
before...


How could I do that?  I thought the only way to use zlib in PHP was  
through the stream functions.





It's also possible your zlib file is just plain corrupt, and neither
will work...


But I am getting the error before I start to read -- it is not a  
zlib 'file', it is a stretch of data within

an ordinary file that has been compressed with zlib.

Thanks
Bob


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php