1--TEST--
2Set and get image resolution of JPEG images
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!(imagetypes() & IMG_JPEG)) die('skip JPEG support not available');
8?>
9--FILE--
10<?php
11$filename = __DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg';
12
13$exp = imagecreate(100, 100);
14imagecolorallocate($exp, 255, 0, 0);
15
16imageresolution($exp, 71);
17imagejpeg($exp, $filename);
18$act = imagecreatefromjpeg($filename);
19var_dump(imageresolution($act));
20
21imageresolution($exp, 71, 299);
22imagejpeg($exp, $filename);
23$act = imagecreatefromjpeg($filename);
24var_dump(imageresolution($act));
25imageresolution($exp, 71, 299);
26
27try {
28	imagejpeg($exp, $filename, 101);
29} catch (\ValueError $e) {
30	echo $e->getMessage();
31}
32?>
33--EXPECT--
34array(2) {
35  [0]=>
36  int(71)
37  [1]=>
38  int(71)
39}
40array(2) {
41  [0]=>
42  int(71)
43  [1]=>
44  int(299)
45}
46imagejpeg(): Argument #3 ($quality) must be at between -1 and 100
47--CLEAN--
48<?php
49@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg');
50?>
51