Image Filters

    Applying the demo filter

    DemoFilter Example

    1. <?php
    2. namespace Intervention\Image\Filters;
    3. class DemoFilter implements FilterInterface
    4. {
    5. /**
    6. * Default size of filter effects
    7. */
    8. const DEFAULT_SIZE = 10;
    9. /**
    10. *
    11. * @var integer
    12. */
    13. private $size;
    14. /**
    15. * Creates new instance of filter
    16. *
    17. * @param integer $size
    18. */
    19. public function __construct($size = null)
    20. {
    21. $this->size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE;
    22. /**
    23. * Applies filter effects to given image
    24. *
    25. * @param Intervention\Image\Image $image
    26. * @return Intervention\Image\Image
    27. */
    28. public function applyFilter(\Intervention\Image\Image $image)
    29. {
    30. $image->pixelate($this->size);
    31. $image->greyscale();
    32. return $image;
    33. }