ContrastCommand.php 487 B

123456789101112131415161718192021
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. use Intervention\Image\Commands\AbstractCommand;
  4. class ContrastCommand extends AbstractCommand
  5. {
  6. /**
  7. * Changes contrast of image
  8. *
  9. * @param \Intervention\Image\Image $image
  10. * @return boolean
  11. */
  12. public function execute($image)
  13. {
  14. $level = $this->argument(0)->between(-100, 100)->required()->value();
  15. return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1));
  16. }
  17. }