Constructor.
protected __construct ( array $params, array $context = [] ) | ||
$params | array | The image object parameters. Values include: - background: (string) The background color. DEFAULT: white. - data: (string) The image binary data. - height: (integer) The desired image height. - type: (string) The output image type (png, jpeg etc.). DEFAULT: png. - width: (integer) The desired image width. |
$context | array | The object context - configuration, injected objects: - logger: (Horde_Log_Logger) A logger. - tmpdir: [REQUIRED] (string) Temporary directory. |
/** * PNG image constructor. */ public function __construct($params, $context = array()) { parent::__construct($params, $context); if (!empty($params['width'])) { $this->rectangle(0, 0, $params['width'], $params['height'], $this->_background, $this->_background); } }
/** * Const'r * * @see Horde_Image_Base::_construct */ public function __construct($params, $context = array()) { if (!Horde_Util::loadExtension('imagick')) { throw new Horde_Image_Exception('Required PECL Imagick extension not found.'); } parent::__construct($params, $context); ini_set('imagick.locale_fix', 1); $this->_imagick = new Imagick(); if (!empty($params['filename'])) { $this->loadFile($params['filename']); } elseif (!empty($params['data'])) { $this->loadString($params['data']); } else { $this->_width = max(array($this->_width, 1)); $this->_height = max(array($this->_height, 1)); try { $this->_imagick->newImage($this->_width, $this->_height, $this->_background); } catch (ImagickException $e) { throw new Horde_Image_Exception($e); } } try { $this->_imagick->setImageFormat($this->_type); } catch (ImagickException $e) { throw new Horde_Image_Exception($e); } }
/** * Constructor. * * @see Horde_Image_Base::_construct */ public function __construct($params, $context = array()) { parent::__construct($params, $context); $this->_svg = new XML_SVG_Document(array('width' => $this->_width, 'height' => $this->_height)); if ($this->_background != 'none') { $this->rectangle(0, 0, $this->_width, $this->_height, $this->_background, $this->_background); } }
/** */ public function __construct($params, $context = array()) { parent::__construct($params, $context); if (!empty($params['filename'])) { $this->loadFile($params['filename']); } elseif (!empty($params['data'])) { $this->loadString($params['data']); } }
/** * Constructor. * * @see Horde_Image_Base::_construct */ public function __construct($params, $context = array()) { parent::__construct($params, $context); $this->_movie = new SWFMovie(); $this->_movie->setDimension($this->_width, $this->_height); $color = Horde_Image::getRGB($this->_background); $this->_movie->setBackground($color[0], $color[1], $color[2]); $this->_movie->setRate(30); }
/** * Const'r * * @param $params * * @return Horde_Image_gd */ public function __construct($params, $context = array()) { parent::__construct($params, $context); if (!empty($params['filename'])) { $this->loadFile($params['filename']); } elseif (!empty($params['data'])) { $this->loadString($params['data']); } elseif (!empty($params['width'])) { $this->_im = $this->create($this->_width, $this->_height); $this->call('imageFill', array($this->_im, 0, 0, $this->_allocateColor($this->_background))); } }
/** * Constructor. * * @see Horde_Image_Base::_construct */ public function __construct($params, $context = array()) { parent::__construct($params, $context); if (empty($context['convert'])) { throw new InvalidArgumentException('A path to the convert binary is required.'); } $this->_convert = $context['convert']; if (!empty($context['identify'])) { $this->_identify = $context['identify']; } if (!empty($params['filename'])) { $this->loadFile($params['filename']); } elseif (!empty($params['data'])) { $this->loadString($params['data']); } else { $cmd = "-size {$this->_width}x{$this->_height} xc:{$this->_background} +profile \"*\" {$this->_type}:__FILEOUT__"; $this->executeConvertCmd($cmd); } }
public function __construct($params) { parent::__construct($params); $this->_svg = new XML_SVG_Document(array('width' => $this->_width, 'height' => $this->_height)); }