示例#1
0
 /**
  * @return ImagickContract|MockObject
  */
 protected function imagick() : MockObject
 {
     if (empty($this->imagick)) {
         $this->imagick = $this->makeMock(ImagickContract::class);
         $this->imagick->expects($this->any())->method('getImage')->willReturn($this->imagick);
     }
     return $this->imagick;
 }
示例#2
0
 /**
  * @return ImagickContract
  */
 private function waterMark()
 {
     if (!$this->waterMark->count()) {
         $this->waterMark->setBackgroundColor(new ImagickPixel('transparent'));
         $this->waterMark->readImage(resource_path(self::LOCATION));
     }
     return $this->waterMark;
 }
 /**
  * @param Image $image
  *
  * @return ImagickCollection
  */
 public function preProcess(Image $image) : ImagickCollection
 {
     $this->imagick->readImage($image->storageLocation());
     $this->imagick->setFilename($image->filename());
     $collection = new ImagickCollection([$this->imagick]);
     foreach ($this->transformers as $transformer) {
         $transformer->applyTo($collection);
     }
     return $collection;
 }
示例#4
0
 /**
  * @param $sizeName
  * @param ImagickContract|Imagick $sized
  *
  * @return string
  */
 private function sizedFilename(string $sizeName, $sized) : string
 {
     $pathInfo = pathinfo($sized->getFilename());
     return "{$pathInfo['filename']}-{$sizeName}.{$pathInfo['extension']}";
 }