xref: /PHP-8.0/ext/gd/tests/pngcomp.phpt (revision c5401854)
1--TEST--
2png compression test
3--SKIPIF--
4<?php
5    if (!extension_loaded('gd')) {
6        die("skip gd extension not available.");
7    }
8
9    if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
10        die("skip png support unavailable");
11    }
12?>
13--FILE--
14<?php
15    $cwd = __DIR__;
16
17    echo "PNG compression test: ";
18
19        $im = imagecreatetruecolor(20,20);
20        imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
21        imagepng($im, $cwd . '/test_pngcomp.png', 9);
22
23        $im2 = imagecreatefrompng($cwd . '/test_pngcomp.png');
24        $col = imagecolorat($im2, 8,8);
25        if ($col == 0xffffff) {
26                echo "ok\n";
27        }
28
29    @unlink($cwd . "/test_pngcomp.png");
30?>
31--EXPECT--
32PNG compression test: ok
33