ManaPHP\Image\Adapter\Imagick::__construct PHP Method

__construct() public method

public __construct ( string $file )
$file string
    public function __construct($file)
    {
        if (!extension_loaded('imagick')) {
            throw new ImagickException('Imagick is not installed, or the extension is not loaded');
        }
        $this->_file = realpath($this->alias->resolve($file));
        if (!$this->_file) {
            throw new ImagickException('`:file` file is not exists', ['file' => $file]);
        }
        $this->_image = new \Imagick();
        if (!$this->_image->readImage($this->_file)) {
            throw new ImagickException('Imagick::readImage `:file` failed', ['file' => $file]);
        }
        if ($this->_image->getNumberImages() !== 1) {
            throw new ImagickException('not support multiple iterations: `:file`', ['file' => $file]);
        }
        if (!$this->_image->getImageAlphaChannel()) {
            $this->_image->setImageAlphaChannel(\Imagick::ALPHACHANNEL_SET);
        }
        $this->_width = $this->_image->getImageWidth();
        $this->_height = $this->_image->getImageHeight();
    }