Source for file filter.php

Documentation is available at filter.php

  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.  * Class to manipulate an image.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Image
  17.  * @since       11.3
  18.  */
  19. abstract class JImageFilter
  20. {
  21.     /**
  22.      * @var    resource  The image resource handle.
  23.      * @since  11.3
  24.      */
  25.     protected $handle;
  26.  
  27.     /**
  28.      * Class constructor.
  29.      *
  30.      * @param   resource  $handle  The image resource on which to apply the filter.
  31.      *
  32.      * @since   11.3
  33.      * @throws  InvalidArgumentException
  34.      * @throws  RuntimeException
  35.      */
  36.     public function __construct($handle)
  37.     {
  38.         // Verify that image filter support for PHP is available.
  39.         if (!function_exists('imagefilter'))
  40.         {
  41.             // @codeCoverageIgnoreStart
  42.             JLog::add('The imagefilter function for PHP is not available.'JLog::ERROR);
  43.             throw new RuntimeException('The imagefilter function for PHP is not available.');
  44.  
  45.             // @codeCoverageIgnoreEnd
  46.         }
  47.  
  48.         // Make sure the file handle is valid.
  49.         if (!is_resource($handle|| (get_resource_type($handle!= 'gd'))
  50.         {
  51.             JLog::add('The image handle is invalid for the image filter.'JLog::ERROR);
  52.             throw new InvalidArgumentException('The image handle is invalid for the image filter.');
  53.         }
  54.  
  55.         $this->handle = $handle;
  56.     }
  57.  
  58.     /**
  59.      * Method to apply a filter to an image resource.
  60.      *
  61.      * @param   array  $options  An array of options for the filter.
  62.      *
  63.      * @return  void 
  64.      *
  65.      * @since   11.3
  66.      */
  67.     abstract public function execute(array $options array());
  68. }

Documentation generated on Tue, 19 Nov 2013 15:03:19 +0100 by phpDocumentor 1.4.3