Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3.0416 |
Changes | 0 |
1 | <?php |
||
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 | $img = clone $image; |
|
23 | |||
24 | 2 | [$width, $height] = explode('x', $size); |
|
25 | |||
26 | 2 | $img->resize($width, $height, function ($constraint) { |
|
27 | $constraint->aspectRatio(); |
||
28 | $constraint->upsize(); |
||
29 | 2 | })->save($this->getThumbFilePath($img, $name), 100); |
|
30 | } |
||
52 |