RotateCommand.php 629 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. use Intervention\Image\Gd\Color;
  4. class RotateCommand extends \Intervention\Image\Commands\AbstractCommand
  5. {
  6. /**
  7. * Rotates image counter clockwise
  8. *
  9. * @param \Intervention\Image\Image $image
  10. * @return boolean
  11. */
  12. public function execute($image)
  13. {
  14. $angle = $this->argument(0)->type('numeric')->required()->value();
  15. $color = $this->argument(1)->value();
  16. $color = new Color($color);
  17. // rotate image
  18. $image->setCore(imagerotate($image->getCore(), $angle, $color->getInt()));
  19. return true;
  20. }
  21. }