Total Complexity | 6 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 91.3% |
Changes | 0 |
1 | <?php |
||
9 | class ImagePlugin |
||
10 | { |
||
11 | 2 | public function handle($path) |
|
12 | { |
||
13 | 2 | $image = Image::make($path); |
|
14 | |||
15 | 2 | if (Config::get('uploadable.use_image_orientate', false)) { |
|
16 | 2 | $image->orientate(); |
|
17 | } |
||
18 | |||
19 | 2 | $image->save($path, 100); |
|
20 | |||
21 | 2 | foreach (Config::get('uploadable.thumbs', []) as $name => $size) { |
|
22 | 2 | $image = clone $image; |
|
23 | |||
24 | 2 | [$width, $height] = explode('x', $size); |
|
25 | |||
26 | 2 | $image->resize($width, $height, function ($constraint) { |
|
27 | $constraint->aspectRatio(); |
||
28 | $constraint->upsize(); |
||
29 | 2 | })->save($this->getThumbFilePath($image, $name), 100); |
|
30 | } |
||
31 | 2 | } |
|
32 | |||
33 | 2 | public function getThumbsDirectory($baseDir, $name) |
|
42 | } |
||
43 | |||
44 | 2 | public function getThumbFilePath($image, $name) |
|
52 |