code: public function open($imgname)
      {
          //检测图像文件
          if (!is_file($imgname)) {
              throw new \Exception('不存在的图像文件');
          }
  
          //销毁已存在的图像
          empty($this->im) || $this->im->destroy();
  
          //载入图像
          $this->im = new \Imagick(realpath($imgname));
  
          //设置图像信息
          $this->info = [
              'width'  => $this->im->getImageWidth(),
              'height' => $this->im->getImageHeight(),
              'type'   => strtolower($this->im->getImageFormat()),
              'mime'   => $this->im->getImageMimeType(),
          ];
      }
docs: 打开一张图像
  
  @param  string $imgname 图像路径