Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
namespace Intervention\Image\Commands;
use \Closure;
class RectangleCommand extends \Intervention\Image\Commands\AbstractCommand
{
/**
* Draws rectangle on given image
*
* @param \Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
$x1 = $this->argument(0)->type('numeric')->required()->value();
$y1 = $this->argument(1)->type('numeric')->required()->value();
$x2 = $this->argument(2)->type('numeric')->required()->value();
$y2 = $this->argument(3)->type('numeric')->required()->value();
$callback = $this->argument(4)->type('closure')->value();
$rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape',
$image->getDriver()->getDriverName());
$rectangle = new $rectangle_classname($x1, $y1, $x2, $y2);
if ($callback instanceof Closure) {
$callback($rectangle);
}
$rectangle->applyToImage($image, $x1, $y1);
return true;
}
}
|
Revision |
Author |
Commited |
Message |
1464
|
MOliva
|
Tue 13 Oct, 2020 11:16:56 +0000 |
|