| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function resize(string $newPath) |
||
| 22 | { |
||
| 23 | $relativePath = $newPath; |
||
| 24 | $finalNewPath = storage_path().'/'.$newPath; |
||
| 25 | if(isset($this->ext)){ |
||
| 26 | $finalNewPath = storage_path().'/'.$newPath.'.'.$this->ext; |
||
| 27 | $relativePath = $newPath.'.'.$this->ext; |
||
| 28 | } |
||
| 29 | if(app(PictureHandler::class)->width($this->path) > 600) { |
||
| 30 | app(PictureHandler::class)->widen($this->path, $finalNewPath, 600); |
||
| 31 | $this->relativePath = $relativePath; |
||
| 32 | return; |
||
| 33 | } |
||
| 34 | |||
| 35 | if(app(PictureHandler::class)->height($this->path) > 400) { |
||
| 36 | app(PictureHandler::class)->heighten($this->path, $finalNewPath, 400); |
||
| 37 | $this->relativePath = $relativePath; |
||
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | app(PictureHandler::class)->write($this->path, $finalNewPath); |
||
| 42 | $this->relativePath = $relativePath; |
||
| 43 | } |
||
| 50 |