示例#1
0
 /**
  * @return \Imagick
  */
 public function output()
 {
     switch (strtolower($this->outputFormat)) {
         case 'puush':
             $this->output = new Puush($this->getApiKey());
             break;
         default:
             //generate file
             $this->output = new File();
             break;
     }
     //get imagick image
     $image = $this->getImage();
     $this->output->addHashInput($image->getImageSignature());
     $this->output->addHashInput($this->getTopCaption()->getText());
     $this->output->addHashInput($this->getBottomCaption()->getText());
     if (!$this->output->exists()) {
         if (!$this->topCaption->isEmpty()) {
             $this->topCaption->annotateImage();
         }
         if (!$this->bottomCaption->isEmpty()) {
             $this->bottomCaption->annotateImage();
         }
         $image->setImageFormat("jpg");
         //$image->setCompression( Imagick::COMPRESSION_JPEG );
         $image->setCompressionQuality(70);
         $this->output->upload($image);
     }
     return $this->output->getOutputPath();
 }
示例#2
0
 /**
  * @covers MemePuush\Caption::isEmpty
  */
 public function testIsEmpty()
 {
     $object = new Caption($this->image, '');
     $this->assertTrue($object->isEmpty());
     $object = new Caption($this->image, 'test');
     $this->assertFalse($object->isEmpty());
 }