frameImage() public static method

Use when you don't want to replace all pixels in the clipping area with the border color i.e. you want to "frame" the existing image. Preserves transparency etc.
public static frameImage ( &$image, string $color, integer $width, integer $height )
$color string The border color.
$width integer The image width including the border.
$height integer The image height including the border.
Example #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;
 }
Example #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);
         }
     }
 }