| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function execute(Image $image) |
||
| 23 | { |
||
| 24 | /** @var TextCommandOption $options */ |
||
| 25 | $options = $this->options; |
||
| 26 | |||
| 27 | $color = ColorUtils::colorIdentifier($image->getResource(), |
||
| 28 | $options->getColor() |
||
| 29 | ); |
||
| 30 | |||
| 31 | $fontPixel = round($options->getText()->getFontSize() * 0.75); |
||
| 32 | |||
| 33 | if (!function_exists('imagettftext')) { |
||
| 34 | throw new ModuleNotFoundException('function imagettftext not installed'); |
||
| 35 | } |
||
| 36 | |||
| 37 | imagettftext($image->getResource(), $fontPixel, 0, |
||
| 38 | $options->getCoordinate1()->getX(), |
||
| 39 | $options->getCoordinate1()->getY() + $fontPixel, |
||
|
|
|||
| 40 | $color, $options->getText()->getFont(), $options->getText()->getText()); |
||
| 41 | |||
| 42 | return $image; |
||
| 43 | } |
||
| 45 |