Inheritance: extends Pimcore\Image\Adapter
示例#1
0
 /**
  * @return ImageMagick
  */
 protected function initResource()
 {
     if (null === $this->resource) {
         $this->resource = new \Imagick();
     }
     $this->resource->readImage($this->imagePath);
     $this->setWidth($this->resource->getImageWidth())->setHeight($this->resource->getImageHeight());
     return $this;
 }
示例#2
0
 /**
  * @return array|null
  */
 public function getVectorFormatEmbeddedRasterDimensions()
 {
     if (in_array($this->resource->getimageformat(), ["EPT", "EPDF", "EPI", "EPS", "EPS2", "EPS3", "EPSF", "EPSI", "EPT", "PDF", "PFA", "PFB", "PFM", "PS", "PS2", "PS3"])) {
         // we need a special handling for PhotoShop EPS
         $i = 0;
         ini_set("auto_detect_line_endings", true);
         // we need to turn this on, as the damn f****** Mac has different line endings in EPS files, Prost Mahlzeit!
         $epsFile = fopen($this->imagePath, 'r');
         while (($eps_line = fgets($epsFile)) && $i < 100) {
             if (preg_match("/%ImageData: ([0-9]+) ([0-9]+)/i", $eps_line, $matches)) {
                 return ["width" => $matches[1], "height" => $matches[2]];
                 break;
             }
             $i++;
         }
     }
     return null;
 }
 /**
  *
  */
 protected function reinitializeImage()
 {
     $this->isOriginal = false;
     parent::reinitializeImage();
 }