/** * 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; }
/** * 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); } } }
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; }