Conditions | 4 |
Paths | 0 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function modify($image) |
||
42 | { |
||
43 | try { |
||
44 | if ($this->verifyIfThePropertyChange()) { |
||
45 | |||
46 | $imageWithNewScale = imagescale( |
||
47 | $image, |
||
48 | $this->get()['width'], |
||
49 | $this->get()['height'], |
||
50 | IMG_BILINEAR_FIXED |
||
51 | ); |
||
52 | if (!$imageWithNewScale) { |
||
53 | throw new \Exception('Error with scale, dimesions(' . $this->get()['width'] . ',' . $this->get()['height'] . ').'); |
||
54 | } |
||
55 | |||
56 | $image = $imageWithNewScale; |
||
57 | } |
||
58 | } catch (\Exception $e) { |
||
59 | ResponseHandler::fail($e->getMessage()); |
||
60 | } finally { |
||
61 | return $image; |
||
62 | } |
||
65 |