| Total Complexity | 13 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class Thumb |
||
| 14 | { |
||
| 15 | |||
| 16 | /** @var Cropper */ |
||
| 17 | private $cropper; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | private $uploads; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Thumb constructor. |
||
| 24 | */ |
||
| 25 | public function __construct() |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function make($image, $width, $height = null, $zc = null, $imageName = null) |
||
| 35 | { |
||
| 36 | $sz = ($width ? "?w={$width}" : null); |
||
| 37 | $sz .= (empty($sz) && !empty($height) ? "?h={$width}" : (!empty($sz) && !empty($height) ? "&h={$height}" : null)); |
||
| 38 | $sz .= (!empty($zc) ? "&zc={$zc}" : null); |
||
| 39 | |||
| 40 | if (file_exists("{$this->uploads}/{$image}") && is_file("{$this->uploads}/{$image}")) { |
||
| 41 | return $this->cropper->imgCreate("{$this->uploads}/{$image}{$sz}", $imageName); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $this->cropper->imgCreate("{$image}{$sz}", $imageName); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string|null $image |
||
| 49 | */ |
||
| 50 | public function flush($image = null) |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return Cropper |
||
| 63 | */ |
||
| 64 | public function cropper() |
||
| 67 | } |
||
| 68 | |||
| 70 |