public function process(Image $image) { if ($this->request->query->has('background') || $this->request->query->has('limit_color')) { $background = $this->request->query->has('background') ? $this->request->query->get('background') : $this->request->query->get('limit_color'); if (1 === preg_match('#^([0-9a-f]{6})$#', $background)) { $image->limitColors(null, '#' . $background); } } }
/** * Set a maximum number of colors for the current image * * @param integer $count * @param mixed $matte * @return \Intervention\Image\Image * @static */ public static function limitColors($count = null, $matte = null) { return \Intervention\Image\Image::limitColors($count, $matte); }