[PHP] Gzinflate on a string that has been base_64 encoded in Windows

2006-06-08 Thread Venky

Greetings!

I have a long piece of string that is apparently a PNG image which has been
base_64 decoded in an XML file. I can retreive this string without problem.
The string is in $mystra

$pngdata = base64_decode($mystra);
$pngdata = gzinflate($pngdata);

When i try to gzinflate it , i get a warning that says data error and if i
write pngdata to a binary file using fopen, there is 0 bytes (because of the
warning).

If i just write the base_64 decoded data to a binary file, then I can't open
the file as a gziped file. (it is not a valid gzip'ed file)


From the person who sent me the XML file, what I was told


the base_64 decoded data will give me the deflated binary array for the
image, which I would need to inflate using an InflaterInputStream, and as a
result, I will get the PNG file that is represented in $mystra.

I probably need to add some PNG headers to it and/or explode the base_64
decoded data and then add headers to it.

I am getting quite lost here. Can anyone provide some hints please?

Regards


Venky


Re: [PHP] Gzinflate on a string that has been base_64 encoded in Windows

2006-06-08 Thread Chris

Venky wrote:

Greetings!

I have a long piece of string that is apparently a PNG image which has been
base_64 decoded in an XML file. I can retreive this string without problem.
The string is in $mystra

$pngdata = base64_decode($mystra);
$pngdata = gzinflate($pngdata);

When i try to gzinflate it , i get a warning that says data error and 
if i
write pngdata to a binary file using fopen, there is 0 bytes (because of 
the

warning).

If i just write the base_64 decoded data to a binary file, then I can't 
open

the file as a gziped file. (it is not a valid gzip'ed file)


From the person who sent me the XML file, what I was told


the base_64 decoded data will give me the deflated binary array for the
image, which I would need to inflate using an InflaterInputStream, and as a
result, I will get the PNG file that is represented in $mystra.

I probably need to add some PNG headers to it and/or explode the base_64
decoded data and then add headers to it.

I am getting quite lost here. Can anyone provide some hints please?


Hmm, a couple of things. Do you get it base64_encoded or decoded? You're 
using decode as both terms so it's confusing for us.


Does the xml feed give you it inflated or deflated? gzdeflate will only 
work if it is already inflated with gzinflate.


Can you get the other person to show you the code of how he puts the 
image into the xml feed? That will tell you exactly what you need to undo.


--
Postgresql  php tutorials
http://www.designmagick.com/

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