Gzinflate on a string that has been base_64 encoded in Windows
| From: | Venky | Date: | Thu, 08 Jun 2006 11:10:46 +0000 |
| Subject: | Gzinflate on a string that has been base_64 encoded in Windows | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237595@lists.php.net to get a copy of this message | ||
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