1
1
<?php
2
2
3
- namespace ImageConverter ;
3
+ namespace Jens \ ImageConverter ;
4
4
5
5
class ImageConverter
6
6
{
@@ -86,8 +86,8 @@ private function saveImage($to, $image, $quality)
86
86
}
87
87
88
88
89
- if (isset ($ quality ) && !is_int ($ quality )) {
90
- throw new \InvalidArgumentException (sprintf ('The %s quality has to be an integer ' , $ quality ));
89
+ if (isset ($ quality ) && !is_int ($ quality )) {
90
+ throw new \InvalidArgumentException (sprintf ('The %s quality has to be an integer ' , $ quality ));
91
91
}
92
92
93
93
switch ($ extension ) {
@@ -100,7 +100,7 @@ private function saveImage($to, $image, $quality)
100
100
throw new \InvalidArgumentException (sprintf ('The %s quality is out of range ' , $ quality ));
101
101
}
102
102
$ image = imagejpeg ($ image , $ to , $ quality );
103
- break ;
103
+ break ;
104
104
case 'png ' :
105
105
if ($ quality < -1 && $ quality > 9 ) {
106
106
throw new \InvalidArgumentException (sprintf ('The %s quality is out of range ' , $ quality ));
@@ -169,17 +169,3 @@ private function makeDirectory($to)
169
169
return $ result ;
170
170
}
171
171
}
172
-
173
- /**
174
- * Helper function
175
- *
176
- * @param string $from
177
- * @param string $to
178
- *
179
- * @return resource
180
- * @throws \InvalidArgumentException
181
- */
182
- function convert ($ from , $ to , $ quality = null ) {
183
- $ converter = new ImageConverter ();
184
- return $ converter ->convert ($ from , $ to , $ quality );
185
- }
0 commit comments