PHP ActiveX
PHP ActiveX
Decompress Bytes
See more Compression Examples
Demonstrates how to decompress binary data.Chilkat PHP ActiveX Downloads
<?php
$success = 0;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// See this example to compress bytes: Compress Bytes
$fac = new COM("Chilkat.FileAccess");
$compressedBytes = $fac->ReadEntireFile('qa_data/compressed/compressedBmp.dat');
if ($fac->LastMethodSuccess != 1) {
print $fac->LastErrorText . "\n";
exit;
}
$compress = new COM("Chilkat.Compression");
$compress->Algorithm = 'deflate';
$decompressedBytes = $compress->DecompressBytes($compressedBytes);
if ($compress->LastMethodSuccess != 1) {
print $compress->LastErrorText . "\n";
exit;
}
$success = $fac->WriteEntireFile('qa_output/decompressed.bmp',$decompressedBytes);
if ($fac->LastMethodSuccess != 1) {
print $fac->LastErrorText . "\n";
exit;
}
?>