| Conditions | 4 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 25 | public function load(ImageInterface $image, array $options = array()) |
||
| 26 | { |
||
| 27 | $background = $image->palette()->color( |
||
| 28 | isset($options['color']) ? $options['color'] : '#fff', |
||
| 29 | isset($options['transparency']) ? $options['transparency'] : null |
||
| 30 | ); |
||
| 31 | $topLeft = new Point(0, 0); |
||
| 32 | $size = $image->getSize(); |
||
| 33 | |||
| 34 | if (isset($options['size'])) { |
||
| 35 | list($width, $height) = $options['size']; |
||
| 36 | |||
| 37 | $size = new Box($width, $height); |
||
| 38 | $topLeft = new Point(($width - $image->getSize()->getWidth()) / 2, ($height - $image->getSize()->getHeight()) / 2); |
||
| 39 | } |
||
| 40 | |||
| 41 | $canvas = $this->imagine->create($size, $background); |
||
| 42 | |||
| 43 | return $canvas->paste($image, $topLeft); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |