pngcomp.phpt 683 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. png compression test
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
  8. die("skip png support unavailable");
  9. }
  10. ?>
  11. --FILE--
  12. <?php
  13. $cwd = __DIR__;
  14. echo "PNG compression test: ";
  15. $im = imagecreatetruecolor(20,20);
  16. imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
  17. imagepng($im, $cwd . '/test_pngcomp.png', 9);
  18. $im2 = imagecreatefrompng($cwd . '/test_pngcomp.png');
  19. $col = imagecolorat($im2, 8,8);
  20. if ($col == 0xffffff) {
  21. echo "ok\n";
  22. }
  23. @unlink($cwd . "/test_pngcomp.png");
  24. ?>
  25. --EXPECT--
  26. PNG compression test: ok