first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View 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());
}

View 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]);
}
}

View 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]);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View 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);
}
}

View 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);
}
}

View 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]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>