/usr/share/php/Horde/Image/Effect.php is in php-horde-image 2.1.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | <?php
/**
* The Horde_Image_Effect parent class defines a general API for
* ways to apply effects to Horde_Image objects.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Image
*/
class Horde_Image_Effect
{
/**
* Effect parameters.
*
* @var array
*/
protected $_params = array();
/**
* The bound Horde_Image object
*
* @var Horde_Image
*/
protected $_image = null;
protected $_logger;
/**
* Effect constructor.
*
* @param array $params Any parameters for the effect. Parameters are
* documented in each subclass.
*/
public function __construct($params = array())
{
foreach ($params as $key => $val) {
$this->_params[$key] = $val;
}
}
/**
* Bind this effect to a Horde_Image object.
*
* @param Horde_Image $image The Horde_Image object
*
* @TODO: Can we get rid of the reference here? (Looks OK for GD, but need
* to test im/imagick also).
*
* @return void
*/
public function setImageObject(&$image)
{
$this->_image = &$image;
}
public function setLogger($logger)
{
$this->_logger = $logger;
}
static public function factory($type, $driver, $params)
{
if (is_array($type)) {
list($app, $type) = $type;
}
// First check for a driver specific effect, if we can't find one,
// assume there is a vanilla effect object around.
$class = 'Horde_Image_Effect_' . $driver . '_' . $type;
$vclass = 'Horde_Image_Effect_' . $type;
if (!class_exists($class) && !class_exists($vclass)) {
if (!empty($app)) {
$path = $GLOBALS['registry']->get('fileroot', $app) . '/lib/Image/Effect/' . $driver . '/' . $type . '.php';
} else {
$path = 'Horde/Image/Effect/' . $driver . '/' . $type . '.php';
}
@include_once $path;
if (!class_exists($class)) {
if (!empty($app)) {
$path = $GLOBALS['registry']->get('fileroot', $app) . '/lib/Image/Effect/' . $type . '.php';
} else {
$path = 'Horde/Image/Effect/' . $type . '.php';
}
$class = $vclass;
@include_once $path;
}
}
if (class_exists($class)) {
$effect = new $class($params);
} else {
$params['logger']->err(sprintf("Horde_Image_Effect %s for %s driver not found.", $type, $driver));
throw new Horde_Image_Exception(sprintf("Horde_Image_Effect %s for %s driver not found.", $type, $driver));
}
if (!empty($params['logger'])) {
$effect->setLogger($params['logger']);
}
return $effect;
}
}
|