mirror of
https://github.com/Intervention/image.git
synced 2025-08-11 08:24:02 +02:00
implemented "digit" type
This commit is contained in:
@@ -15,10 +15,10 @@ class CropCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->required()->value();
|
$height = $this->argument(1)->type('digit')->required()->value();
|
||||||
$x = $this->argument(2)->type('integer')->value();
|
$x = $this->argument(2)->type('digit')->value();
|
||||||
$y = $this->argument(3)->type('integer')->value();
|
$y = $this->argument(3)->type('digit')->value();
|
||||||
|
|
||||||
if (is_null($width) || is_null($height)) {
|
if (is_null($width) || is_null($height)) {
|
||||||
throw new \Intervention\Image\Exception\InvalidArgumentException(
|
throw new \Intervention\Image\Exception\InvalidArgumentException(
|
||||||
|
@@ -16,8 +16,8 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$filling = $this->argument(0)->value();
|
$filling = $this->argument(0)->value();
|
||||||
$x = $this->argument(1)->type('integer')->value();
|
$x = $this->argument(1)->type('digit')->value();
|
||||||
$y = $this->argument(2)->type('integer')->value();
|
$y = $this->argument(2)->type('digit')->value();
|
||||||
|
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
|
@@ -15,8 +15,8 @@ class FitCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->value($width);
|
$height = $this->argument(1)->type('digit')->value($width);
|
||||||
|
|
||||||
// calculate size
|
// calculate size
|
||||||
$fitted = $image->getSize()->fit(new Size($width, $height));
|
$fitted = $image->getSize()->fit(new Size($width, $height));
|
||||||
|
@@ -12,7 +12,7 @@ class HeightenCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$height = $this->argument(0)->type('integer')->required()->value();
|
$height = $this->argument(0)->type('digit')->required()->value();
|
||||||
|
|
||||||
$this->arguments[0] = null;
|
$this->arguments[0] = null;
|
||||||
$this->arguments[1] = $height;
|
$this->arguments[1] = $height;
|
||||||
|
@@ -14,8 +14,8 @@ class InsertCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
{
|
{
|
||||||
$source = $this->argument(0)->required()->value();
|
$source = $this->argument(0)->required()->value();
|
||||||
$position = $this->argument(1)->type('string')->value();
|
$position = $this->argument(1)->type('string')->value();
|
||||||
$x = $this->argument(2)->type('integer')->value(0);
|
$x = $this->argument(2)->type('digit')->value(0);
|
||||||
$y = $this->argument(3)->type('integer')->value(0);
|
$y = $this->argument(3)->type('digit')->value(0);
|
||||||
|
|
||||||
// build watermark
|
// build watermark
|
||||||
$watermark = $image->getDriver()->init($source);
|
$watermark = $image->getDriver()->init($source);
|
||||||
|
@@ -14,8 +14,8 @@ class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$x = $this->argument(0)->type('integer')->required()->value();
|
$x = $this->argument(0)->type('digit')->required()->value();
|
||||||
$y = $this->argument(1)->type('integer')->required()->value();
|
$y = $this->argument(1)->type('digit')->required()->value();
|
||||||
$format = $this->argument(2)->type('string')->value('array');
|
$format = $this->argument(2)->type('string')->value('array');
|
||||||
|
|
||||||
// pick color
|
// pick color
|
||||||
|
@@ -16,8 +16,8 @@ class PixelCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
{
|
{
|
||||||
$color = $this->argument(0)->required()->value();
|
$color = $this->argument(0)->required()->value();
|
||||||
$color = new Color($color);
|
$color = new Color($color);
|
||||||
$x = $this->argument(1)->type('integer')->required()->value();
|
$x = $this->argument(1)->type('digit')->required()->value();
|
||||||
$y = $this->argument(2)->type('integer')->required()->value();
|
$y = $this->argument(2)->type('digit')->required()->value();
|
||||||
|
|
||||||
return imagesetpixel($image->getCore(), $x, $y, $color->getInt());
|
return imagesetpixel($image->getCore(), $x, $y, $color->getInt());
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$size = $this->argument(0)->type('integer')->value(10);
|
$size = $this->argument(0)->type('digit')->value(10);
|
||||||
|
|
||||||
return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true);
|
return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true);
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->required()->value();
|
$height = $this->argument(1)->type('digit')->required()->value();
|
||||||
$anchor = $this->argument(2)->value('center');
|
$anchor = $this->argument(2)->value('center');
|
||||||
$relative = $this->argument(3)->type('boolean')->value();
|
$relative = $this->argument(3)->type('boolean')->value();
|
||||||
$bgcolor = $this->argument(4)->value();
|
$bgcolor = $this->argument(4)->value();
|
||||||
|
@@ -12,7 +12,7 @@ class WidenCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
|
|
||||||
$this->arguments[0] = $width;
|
$this->arguments[0] = $width;
|
||||||
$this->arguments[1] = null;
|
$this->arguments[1] = null;
|
||||||
|
@@ -15,10 +15,10 @@ class CropCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->required()->value();
|
$height = $this->argument(1)->type('digit')->required()->value();
|
||||||
$x = $this->argument(2)->type('integer')->value();
|
$x = $this->argument(2)->type('digit')->value();
|
||||||
$y = $this->argument(3)->type('integer')->value();
|
$y = $this->argument(3)->type('digit')->value();
|
||||||
|
|
||||||
if (is_null($width) || is_null($height)) {
|
if (is_null($width) || is_null($height)) {
|
||||||
throw new \Intervention\Image\Exception\InvalidArgumentException(
|
throw new \Intervention\Image\Exception\InvalidArgumentException(
|
||||||
|
@@ -17,8 +17,8 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$filling = $this->argument(0)->value();
|
$filling = $this->argument(0)->value();
|
||||||
$x = $this->argument(1)->type('integer')->value();
|
$x = $this->argument(1)->type('digit')->value();
|
||||||
$y = $this->argument(2)->type('integer')->value();
|
$y = $this->argument(2)->type('digit')->value();
|
||||||
|
|
||||||
$imagick = $image->getCore();
|
$imagick = $image->getCore();
|
||||||
|
|
||||||
|
@@ -14,8 +14,8 @@ class FitCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->value($width);
|
$height = $this->argument(1)->type('digit')->value($width);
|
||||||
|
|
||||||
// calculate size
|
// calculate size
|
||||||
$fitted = $image->getSize()->fit(new Size($width, $height));
|
$fitted = $image->getSize()->fit(new Size($width, $height));
|
||||||
|
@@ -12,7 +12,7 @@ class HeightenCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$height = $this->argument(0)->type('integer')->required()->value();
|
$height = $this->argument(0)->type('digit')->required()->value();
|
||||||
|
|
||||||
$this->arguments[0] = null;
|
$this->arguments[0] = null;
|
||||||
$this->arguments[1] = $height;
|
$this->arguments[1] = $height;
|
||||||
|
@@ -14,8 +14,8 @@ class InsertCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
{
|
{
|
||||||
$source = $this->argument(0)->required()->value();
|
$source = $this->argument(0)->required()->value();
|
||||||
$position = $this->argument(1)->type('string')->value();
|
$position = $this->argument(1)->type('string')->value();
|
||||||
$x = $this->argument(2)->type('integer')->value(0);
|
$x = $this->argument(2)->type('digit')->value(0);
|
||||||
$y = $this->argument(3)->type('integer')->value(0);
|
$y = $this->argument(3)->type('digit')->value(0);
|
||||||
|
|
||||||
// build watermark
|
// build watermark
|
||||||
$watermark = $image->getDriver()->init($source);
|
$watermark = $image->getDriver()->init($source);
|
||||||
|
@@ -14,8 +14,8 @@ class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$x = $this->argument(0)->type('integer')->required()->value();
|
$x = $this->argument(0)->type('digit')->required()->value();
|
||||||
$y = $this->argument(1)->type('integer')->required()->value();
|
$y = $this->argument(1)->type('digit')->required()->value();
|
||||||
$format = $this->argument(2)->type('string')->value('array');
|
$format = $this->argument(2)->type('string')->value('array');
|
||||||
|
|
||||||
// pick color
|
// pick color
|
||||||
|
@@ -16,8 +16,8 @@ class PixelCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
{
|
{
|
||||||
$color = $this->argument(0)->required()->value();
|
$color = $this->argument(0)->required()->value();
|
||||||
$color = new Color($color);
|
$color = new Color($color);
|
||||||
$x = $this->argument(1)->type('integer')->required()->value();
|
$x = $this->argument(1)->type('digit')->required()->value();
|
||||||
$y = $this->argument(2)->type('integer')->required()->value();
|
$y = $this->argument(2)->type('digit')->required()->value();
|
||||||
|
|
||||||
// prepare pixel
|
// prepare pixel
|
||||||
$draw = new \ImagickDraw;
|
$draw = new \ImagickDraw;
|
||||||
|
@@ -12,7 +12,7 @@ class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$size = $this->argument(0)->type('integer')->value(10);
|
$size = $this->argument(0)->type('digit')->value(10);
|
||||||
|
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
|
@@ -12,8 +12,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
$height = $this->argument(1)->type('integer')->required()->value();
|
$height = $this->argument(1)->type('digit')->required()->value();
|
||||||
$anchor = $this->argument(2)->value('center');
|
$anchor = $this->argument(2)->value('center');
|
||||||
$relative = $this->argument(3)->type('boolean')->value();
|
$relative = $this->argument(3)->type('boolean')->value();
|
||||||
$bgcolor = $this->argument(4)->value();
|
$bgcolor = $this->argument(4)->value();
|
||||||
|
@@ -12,7 +12,7 @@ class WidenCommand extends ResizeCommand
|
|||||||
*/
|
*/
|
||||||
public function execute($image)
|
public function execute($image)
|
||||||
{
|
{
|
||||||
$width = $this->argument(0)->type('integer')->required()->value();
|
$width = $this->argument(0)->type('digit')->required()->value();
|
||||||
|
|
||||||
$this->arguments[0] = $width;
|
$this->arguments[0] = $width;
|
||||||
$this->arguments[1] = null;
|
$this->arguments[1] = null;
|
||||||
|
Reference in New Issue
Block a user