Cheetah
TextCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use \Closure;
6 
8 {
14  public function execute($image)
15  {
16  $text = $this->argument(0)->required()->value();
17  $x = $this->argument(1)->type('numeric')->value(0);
18  $y = $this->argument(2)->type('numeric')->value(0);
19  $callback = $this->argument(3)->type('closure')->value();
20 
21  $fontclassname = sprintf('\Intervention\Image\%s\Font',
22  $image->getDriver()->getDriverName());
23 
24  $font = new $fontclassname($text);
25 
26  if ($callback instanceof Closure) {
27  $callback($font);
28  }
29 
30  $font->applyToImage($image, $x, $y);
31 
32  return true;
33  }
34 }
Intervention\Image\Commands
Definition: AbstractCommand.php:3
php
Intervention\Image\Commands\TextCommand\execute
execute($image)
Definition: TextCommand.php:14
Intervention\Image\Commands\TextCommand
Definition: TextCommand.php:8
Intervention\Image\Commands\AbstractCommand\argument
argument($key)
Definition: AbstractCommand.php:45
Intervention\Image\Commands\AbstractCommand
Definition: AbstractCommand.php:6