2
2
3
3
namespace Eventviva ;
4
4
5
- use \Exception ;
6
-
7
5
/**
8
6
* PHP class to resize and scale images
9
7
*/
@@ -46,7 +44,7 @@ class ImageResize
46
44
*
47
45
* @param string $image_data
48
46
* @return ImageResize
49
- * @throws \exception
47
+ * @throws ImageResizeException
50
48
*/
51
49
public static function createFromString ($ image_data )
52
50
{
@@ -59,14 +57,14 @@ public static function createFromString($image_data)
59
57
*
60
58
* @param string $filename
61
59
* @return ImageResize
62
- * @throws \Exception
60
+ * @throws ImageResizeException
63
61
*/
64
62
public function __construct ($ filename )
65
63
{
66
64
$ image_info = @getimagesize ($ filename );
67
65
68
66
if (!$ image_info ) {
69
- throw new \ Exception ('Could not read file ' );
67
+ throw new ImageResizeException ('Could not read file ' );
70
68
}
71
69
72
70
list (
@@ -94,12 +92,12 @@ public function __construct($filename)
94
92
break ;
95
93
96
94
default :
97
- throw new \ Exception ('Unsupported image type ' );
95
+ throw new ImageResizeException ('Unsupported image type ' );
98
96
break ;
99
97
}
100
-
98
+
101
99
if (!$ this ->source_image ) {
102
- throw new \ Exception ('Could not load image ' );
100
+ throw new ImageResizeException ('Could not load image ' );
103
101
}
104
102
105
103
return $ this ->resize ($ this ->getSourceWidth (), $ this ->getSourceHeight ());
@@ -222,7 +220,7 @@ public function save($filename, $image_type = null, $quality = null, $permission
222
220
if ($ permissions ) {
223
221
chmod ($ filename , $ permissions );
224
222
}
225
-
223
+
226
224
imagedestroy ($ dest_image );
227
225
228
226
return $ this ;
0 commit comments