Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
contrast.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Image
5  *
6  * @copyright Copyright (C) 2005 - 2013 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 contrast of an image.
14  *
15  * @package Joomla.Platform
16  * @subpackage Image
17  * @since 11.3
18  */
20 {
21  /**
22  * Method to apply a filter to an image resource.
23  *
24  * @param array $options An array of options for the filter.
25  *
26  * @return void
27  *
28  * @since 11.3
29  * @throws InvalidArgumentException
30  */
31  public function execute(array $options = array())
32  {
33  // Validate that the contrast value exists and is an integer.
34  if (!isset($options[IMG_FILTER_CONTRAST]) || !is_int($options[IMG_FILTER_CONTRAST]))
35  {
36  throw new InvalidArgumentException('No valid contrast value was given. Expected integer.');
37  }
38 
39  // Perform the contrast filter.
40  imagefilter($this->handle, IMG_FILTER_CONTRAST, $options[IMG_FILTER_CONTRAST]);
41  }
42 }