(PHP ActiveX) Decompress Bytes
Demonstrates how to decompress binary data.
<?php
// 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
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.FileAccess')
$fac = new COM("Chilkat.FileAccess");
$compressedBytes = $fac->ReadEntireFile('qa_data/compressed/compressedBmp.dat');
if ($fac->LastMethodSuccess != 1) {
print $fac->LastErrorText . "\n";
exit;
}
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Compression')
$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;
}
?>
|