Witam,

chcę skompresować i potem dekompresować kod pewnej aplikacji którą napisałem wink.gif I zastanawiam się czego do tego użyć, których funkcji aby to było dość szybkie i wydajne przy dekompresji. Teraz próbuję czegoś takiego:


  1. function compress($file) {
  2. if (!file_exists("skompresowane")) {
  3. mkdir("skompresowane");
  4. }
  5. echo "<br>Kodowanie pliku: $file";
  6. $string = file_get_contents($file);
  7. $kod = gzcompress($string, 9);
  8. file_put_contents("skompresowane/" . $file, $kod);
  9. echo "<br>Skompresowany plik: skompresowane/$file<br>";
  10. return null;
  11. }
  12.  
  13. function decompress($file) {
  14. $string = file_get_contents($file);
  15. $string = gzinflate($string);
  16. file_put_contents("/tmp/" . $file, $string);
  17. include("/tmp/" . $file);
  18. return null;
  19. }


Jednak gzinflate nie wszędzie działa (lub czegoś mi brakuje) smile.gif