36
36
echo_status (imageavif ($ img , $ outfile , -1 ));
37
37
38
38
echo 'Encoding AVIF with illegal quality: ' ;
39
- echo_status (imageavif ($ img , $ outfile , 1234 ));
39
+ try {
40
+ imageavif ($ img , $ outfile , 1234 );
41
+ } catch (\ValueError $ e ) {
42
+ echo $ e ->getMessage () . PHP_EOL ;
43
+ }
40
44
41
45
echo 'Encoding AVIF with illegal speed: ' ;
42
- echo_status (imageavif ($ img , $ outfile , 70 , 1234 ));
46
+
47
+ try {
48
+ imageavif ($ img , $ outfile , 70 , 1234 );
49
+ } catch (\ValueError $ e ) {
50
+ echo $ e ->getMessage () . PHP_EOL ;
51
+ }
43
52
44
53
echo 'Encoding AVIF losslessly... ' ;
45
54
echo_status (imageavif ($ img , $ outfile , 100 , 0 ));
@@ -66,8 +75,8 @@ Default AVIF encoding: ok
66
75
Encoding AVIF at quality 70: ok
67
76
Encoding AVIF at quality 70 with speed 5: ok
68
77
Encoding AVIF with default quality: ok
69
- Encoding AVIF with illegal quality: ok
70
- Encoding AVIF with illegal speed: ok
78
+ Encoding AVIF with illegal quality: imageavif(): Argument #3 ($quality) must be between -1 and 100
79
+ Encoding AVIF with illegal speed: imageavif(): Argument #4 ($speed) must be between -1 and 10
71
80
Encoding AVIF losslessly... ok
72
81
Decoding the AVIF we just wrote...
73
82
How many pixels are different in the two images? 0
0 commit comments