HeightenCommand.php 802 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. class HeightenCommand extends ResizeCommand
  4. {
  5. /**
  6. * Resize image proportionally to given height
  7. *
  8. * @param \Intervention\Image\Image $image
  9. * @return boolean
  10. */
  11. public function execute($image)
  12. {
  13. $height = $this->argument(0)->type('digit')->required()->value();
  14. $additionalConstraints = $this->argument(1)->type('closure')->value();
  15. $this->arguments[0] = null;
  16. $this->arguments[1] = $height;
  17. $this->arguments[2] = function ($constraint) use ($additionalConstraints) {
  18. $constraint->aspectRatio();
  19. if(is_callable($additionalConstraints))
  20. $additionalConstraints($constraint);
  21. };
  22. return parent::execute($image);
  23. }
  24. }