You've already forked joomla_test
first commit
This commit is contained in:
57
libraries/joomla/image/filter.php
Normal file
57
libraries/joomla/image/filter.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Class to manipulate an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
abstract class JImageFilter
|
||||
{
|
||||
/**
|
||||
* @var resource The image resource handle.
|
||||
* @since 11.3
|
||||
*/
|
||||
protected $handle;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param resource $handle The image resource on which to apply the filter.
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct($handle)
|
||||
{
|
||||
// Make sure the file handle is valid.
|
||||
if (!is_resource($handle) || (get_resource_type($handle) != 'gd'))
|
||||
{
|
||||
JLog::add('The image handle is invalid for the image filter.', JLog::ERROR);
|
||||
throw new InvalidArgumentException('The image handle is invalid for the image filter.');
|
||||
}
|
||||
|
||||
$this->handle = $handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
*/
|
||||
abstract public function execute(array $options = array());
|
||||
}
|
53
libraries/joomla/image/filter/brightness.php
Normal file
53
libraries/joomla/image/filter/brightness.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class adjust the brightness of an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterBrightness extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// Validate that the brightness value exists and is an integer.
|
||||
if (!isset($options[IMG_FILTER_BRIGHTNESS]) || !is_int($options[IMG_FILTER_BRIGHTNESS]))
|
||||
{
|
||||
throw new InvalidArgumentException('No valid brightness value was given. Expected integer.');
|
||||
}
|
||||
|
||||
// Perform the brightness filter.
|
||||
imagefilter($this->handle, IMG_FILTER_BRIGHTNESS, $options[IMG_FILTER_BRIGHTNESS]);
|
||||
}
|
||||
}
|
53
libraries/joomla/image/filter/contrast.php
Normal file
53
libraries/joomla/image/filter/contrast.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class adjust the contrast of an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterContrast extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// Validate that the contrast value exists and is an integer.
|
||||
if (!isset($options[IMG_FILTER_CONTRAST]) || !is_int($options[IMG_FILTER_CONTRAST]))
|
||||
{
|
||||
throw new InvalidArgumentException('No valid contrast value was given. Expected integer.');
|
||||
}
|
||||
|
||||
// Perform the contrast filter.
|
||||
imagefilter($this->handle, IMG_FILTER_CONTRAST, $options[IMG_FILTER_CONTRAST]);
|
||||
}
|
||||
}
|
46
libraries/joomla/image/filter/edgedetect.php
Normal file
46
libraries/joomla/image/filter/edgedetect.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class to add an edge detect effect to an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterEdgedetect extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// Perform the edge detection filter.
|
||||
imagefilter($this->handle, IMG_FILTER_EDGEDETECT);
|
||||
}
|
||||
}
|
43
libraries/joomla/image/filter/emboss.php
Normal file
43
libraries/joomla/image/filter/emboss.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class to emboss an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterEmboss extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
}
|
||||
|
||||
// Perform the emboss filter.
|
||||
imagefilter($this->handle, IMG_FILTER_EMBOSS);
|
||||
}
|
||||
}
|
44
libraries/joomla/image/filter/grayscale.php
Normal file
44
libraries/joomla/image/filter/grayscale.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class to transform an image to grayscale.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterGrayscale extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
}
|
||||
|
||||
// Perform the grayscale filter.
|
||||
imagefilter($this->handle, IMG_FILTER_GRAYSCALE);
|
||||
}
|
||||
}
|
1
libraries/joomla/image/filter/index.html
Normal file
1
libraries/joomla/image/filter/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
43
libraries/joomla/image/filter/negate.php
Normal file
43
libraries/joomla/image/filter/negate.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class to negate the colors of an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterNegate extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
}
|
||||
|
||||
// Perform the negative filter.
|
||||
imagefilter($this->handle, IMG_FILTER_NEGATE);
|
||||
}
|
||||
}
|
43
libraries/joomla/image/filter/sketchy.php
Normal file
43
libraries/joomla/image/filter/sketchy.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class to make an image appear "sketchy".
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterSketchy extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
}
|
||||
|
||||
// Perform the sketchy filter.
|
||||
imagefilter($this->handle, IMG_FILTER_MEAN_REMOVAL);
|
||||
}
|
||||
}
|
50
libraries/joomla/image/filter/smooth.php
Normal file
50
libraries/joomla/image/filter/smooth.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Image Filter class adjust the smoothness of an image.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Image
|
||||
* @since 11.3
|
||||
*/
|
||||
class JImageFilterSmooth extends JImageFilter
|
||||
{
|
||||
/**
|
||||
* Method to apply a filter to an image resource.
|
||||
*
|
||||
* @param array $options An array of options for the filter.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.3
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function execute(array $options = array())
|
||||
{
|
||||
// Verify that image filter support for PHP is available.
|
||||
if (!function_exists('imagefilter'))
|
||||
{
|
||||
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
|
||||
throw new RuntimeException('The imagefilter function for PHP is not available.');
|
||||
}
|
||||
|
||||
// Validate that the smoothing value exists and is an integer.
|
||||
if (!isset($options[IMG_FILTER_SMOOTH]) || !is_int($options[IMG_FILTER_SMOOTH]))
|
||||
{
|
||||
throw new InvalidArgumentException('No valid smoothing value was given. Expected integer.');
|
||||
}
|
||||
|
||||
// Perform the smoothing filter.
|
||||
imagefilter($this->handle, IMG_FILTER_SMOOTH, $options[IMG_FILTER_SMOOTH]);
|
||||
}
|
||||
}
|
1004
libraries/joomla/image/image.php
Normal file
1004
libraries/joomla/image/image.php
Normal file
File diff suppressed because it is too large
Load Diff
1
libraries/joomla/image/index.html
Normal file
1
libraries/joomla/image/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user