Horde_Image_Imagick::loadString PHP Méthode

loadString() public méthode

Loads the image data from a string.
public loadString ( string $image_data )
$image_data string The data to use for the image.
    public function loadString($image_data)
    {
        parent::loadString($image_data);
        $this->_imagick->clear();
        try {
            $this->_imagick->readImageBlob($this->_data);
            $this->_imagick->setImageFormat($this->_type);
            $this->_imagick->setIteratorIndex(0);
        } catch (ImagickException $e) {
            throw new Horde_Image_Exception($e);
        }
        unset($this->_data);
    }

Usage Example

Exemple #1
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;
 }