| Conditions | 3 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function execute(string $uuid, ?int $dim) |
||
| 14 | { |
||
| 15 | $pathPicture = storage_path('app/public/characteristics/'.$uuid.'.png'); |
||
| 16 | |||
| 17 | $img = Image::make($pathPicture); |
||
| 18 | $h = $img->height(); |
||
| 19 | $w = $img->width(); |
||
| 20 | |||
| 21 | if($dim == null){ |
||
|
|
|||
| 22 | return $img->response(); |
||
| 23 | } |
||
| 24 | |||
| 25 | $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){ |
||
| 26 | if($w <= $h) { |
||
| 27 | $image->make($pathPicture)->widen($dim, function ($constraint) { |
||
| 28 | $constraint->upsize(); |
||
| 29 | }); |
||
| 30 | }else{ |
||
| 31 | $image->make($pathPicture)->heighten($dim, function ($constraint) { |
||
| 32 | $constraint->upsize(); |
||
| 33 | }); |
||
| 34 | } |
||
| 35 | }, 3600, true); |
||
| 36 | return $img->response(); |
||
| 37 | } |
||
| 40 |