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