| Conditions | 2 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function execute(string $uuid, int $dim) |
||
| 21 | { |
||
| 22 | $user = $this->userRepository->getById($uuid); |
||
| 23 | $pathPicture = $this->getPathPicture($user); |
||
| 24 | |||
| 25 | $img = Image::make($pathPicture); |
||
| 26 | $h = $img->height(); |
||
| 27 | $w = $img->width(); |
||
| 28 | |||
| 29 | $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){ |
||
| 30 | if($w <= $h) { |
||
| 31 | $image->make($pathPicture)->widen($dim, function ($constraint) { |
||
| 32 | $constraint->upsize(); |
||
| 33 | }); |
||
| 34 | }else{ |
||
| 35 | $image->make($pathPicture)->heighten($dim, function ($constraint) { |
||
| 36 | $constraint->upsize(); |
||
| 37 | }); |
||
| 38 | } |
||
| 39 | }, 3600, true); |
||
| 40 | |||
| 41 | return $img->response(); |
||
| 42 | |||
| 54 |