xref: /PHP-8.4/ext/gd/tests/jpg2gd-mb.phpt (revision 0aaad46c)
1--TEST--
2jpeg <--> gd1/gd2 conversion test
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7    if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8        die("skip test requires GD 2.3.2 or older");
9    }
10
11    if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
12        die("skip jpeg support unavailable");
13    }
14?>
15--FILE--
16<?php
17    $cwd = __DIR__;
18
19    echo "JPEG to GD1 conversion: ";
20    echo imagegd(imagecreatefromjpeg($cwd . "/conv_test私はガラスを食べられます.jpg"), $cwd . "/test私はガラスを食べられます.gd1") ? 'ok' : 'failed';
21    echo "\n";
22
23    echo "JPEG to GD2 conversion: ";
24    echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test私はガラスを食べられます.jpg"), $cwd . "/test私はガラスを食べられます.gd2") ? 'ok' : 'failed';
25    echo "\n";
26
27    echo "GD1 to JPEG conversion: ";
28    echo imagejpeg(imagecreatefromgd($cwd . "/test私はガラスを食べられます.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
29    echo "\n";
30
31    echo "GD2 to JPEG conversion: ";
32    echo imagejpeg(imagecreatefromgd2($cwd . "/test私はガラスを食べられます.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
33    echo "\n";
34
35    @unlink($cwd . "/test私はガラスを食べられます.gd1");
36    @unlink($cwd . "/test私はガラスを食べられます.gd2");
37    @unlink($cwd . "/test_gd1.jpeg");
38    @unlink($cwd . "/test_gd2.jpeg");
39?>
40--EXPECT--
41JPEG to GD1 conversion: ok
42JPEG to GD2 conversion: ok
43GD1 to JPEG conversion: ok
44GD2 to JPEG conversion: ok
45