xref: /PHP-8.1/ext/gd/tests/pngcomp.phpt (revision a375d547)
1--TEST--
2png compression test
3--EXTENSIONS--
4gd
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
15    echo "PNG compression test: ";
16
17        $im = imagecreatetruecolor(20,20);
18        imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
19        imagepng($im, $cwd . '/test_pngcomp.png', 9);
20
21        $im2 = imagecreatefrompng($cwd . '/test_pngcomp.png');
22        $col = imagecolorat($im2, 8,8);
23        if ($col == 0xffffff) {
24                echo "ok\n";
25        }
26
27    @unlink($cwd . "/test_pngcomp.png");
28?>
29--EXPECT--
30PNG compression test: ok
31