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