-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
39 lines (35 loc) · 866 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require "autoload.php";
use Ejss\Exceptions\FileNotFoundException;
use Ejss\Exceptions\UnsuportedFileTypeException;
use Ejss\Exceptions\UnsuportedImageFormatException;
use Ejss\Exceptions\PngCompressionOutRangeException;
use Ejss\Exceptions\JpegQualityOutRangeException;
use Ejss\ImageHandler;
try
{
$img = new ImageHandler("cat.png");
$img->resize(640, 480, true); //width, height, bestfit: true or false
$img->save('cat-resized.png');
}
catch(FileNotFoundException $exception)
{
echo $exception->getMessage();
}
catch(JpegQualityOutRangeException $exception)
{
echo $exception->getMessage();
}
catch(PngCompressionOutRangeException $exception)
{
echo $exception->getMessage();
}
catch(UnsuportedFileTypeException $exception)
{
echo $exception->getMessage();
}
catch(UnsuportedImageFormatException $exception)
{
echo $exception->getMessage();
}
?>