Annotation of embedaddon/php/ext/gd/tests/jpeg2png.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: jpeg <--> png conversion 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:        if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
                     13:                die("skip jpeg support unavailable");
                     14:        }
                     15: ?>
                     16: --FILE--
                     17: <?php
                     18:        $cwd = dirname(__FILE__);
                     19: 
                     20:        echo "PNG to JPEG conversion: ";
                     21:        echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed';
                     22:        echo "\n";
                     23: 
                     24:        echo "Generated JPEG to PNG conversion: ";
                     25:        echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed';
                     26:        echo "\n";
                     27: 
                     28:        echo "JPEG to PNG conversion: ";
                     29:        echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test_png.png") ? 'ok' : 'failed';
                     30:        echo "\n";
                     31: 
                     32:        echo "Generated PNG to JPEG conversion: ";
                     33:        echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed';
                     34:        echo "\n";
                     35: 
                     36:        @unlink($cwd . "/test_jpeg.jpeg");
                     37:        @unlink($cwd . "/test_jpng.png");
                     38:        @unlink($cwd . "/test_png.png");
                     39:        @unlink($cwd . "/test_pjpeg.jpeg");
                     40: ?>
                     41: --EXPECT--
                     42: PNG to JPEG conversion: ok
                     43: Generated JPEG to PNG conversion: ok
                     44: JPEG to PNG conversion: ok
                     45: Generated PNG to JPEG conversion: ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>