1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Image
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Image Filter class adjust the brightness of an image.
14 *
15 * @since 11.3
16 */
17 class JImageFilterBrightness extends JImageFilter
18 {
19 /**
20 * Method to apply a filter to an image resource.
21 *
22 * @param array $options An array of options for the filter.
23 *
24 * @return void
25 *
26 * @since 11.3
27 * @throws InvalidArgumentException
28 */
29 public function execute(array $options = array())
30 {
31 // Validate that the brightness value exists and is an integer.
32 if (!isset($options[IMG_FILTER_BRIGHTNESS]) || !is_int($options[IMG_FILTER_BRIGHTNESS]))
33 {
34 throw new InvalidArgumentException('No valid brightness value was given. Expected integer.');
35 }
36
37 // Perform the brightness filter.
38 imagefilter($this->handle, IMG_FILTER_BRIGHTNESS, $options[IMG_FILTER_BRIGHTNESS]);
39 }
40 }
41