Copyright 2007-2014 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Michael J. Rubinsky (mrubinsk@horde.org)
Inheritance: extends Horde_Image_Base
Exemple #1
0
 /**
  * Draw the border.
  *
  * This draws the configured border to the provided image. Beware,
  * that every pixel inside the border clipping will be overwritten
  * with the background color.
  */
 public function apply()
 {
     if ($this->_params['preserve']) {
         Horde_Image_Imagick::frameImage($this->_image->imagick, $this->_params['bordercolor'], $this->_params['borderwidth'], $this->_params['borderwidth']);
     } else {
         $this->_image->imagick->borderImage(new ImagickPixel($this->_params['bordercolor']), $this->_params['borderwidth'], $this->_params['borderwidth']);
     }
     return true;
 }
Exemple #2
0
 /**
  * Draws the border.
  *
  * This draws the configured border to the provided image. Beware, that
  * every pixel inside the border clipping will be overwritten with the
  * background color.
  */
 public function apply()
 {
     if ($this->_params['preserve']) {
         Horde_Image_Imagick::frameImage($this->_image->imagick, $this->_params['bordercolor'], $this->_params['borderwidth'], $this->_params['borderwidth']);
     } else {
         try {
             $this->_image->imagick->borderImage(new ImagickPixel($this->_params['bordercolor']), $this->_params['borderwidth'], $this->_params['borderwidth']);
         } catch (ImagickPixelException $e) {
             throw new Horde_Image_Exception($e);
         } catch (ImagickException $e) {
             throw new Horde_Image_Exception($e);
         }
     }
 }
Exemple #3
0
 private function _roundBorder($image)
 {
     $context = array('tmpdir' => $this->_image->getTmpDir());
     $size = $image->getImageGeometry();
     $new = new Horde_Image_Imagick(array(), $context);
     $new->loadString($image->getImageBlob());
     $image->destroy();
     $new->addEffect('RoundCorners', array('border' => 2, 'bordercolor' => '#111'));
     $new->applyEffects();
     $return = new Imagick();
     $return->newImage($size['width'] + $this->_params['borderwidth'], $size['height'] + $this->_params['borderwidth'], $this->_params['bordercolor']);
     $return->setImageFormat($this->_image->getType());
     $return->clear();
     $return->readImageBlob($new->raw());
     return $return;
 }