Esempio n. 1
0
 public function testCroppingWithFullBoxDetails()
 {
     $chain = new Chain();
     $chain->setRules([new Duplicate(), new Crop(["width" => 500, "height" => 250, "crop-box-width" => 640, "x" => 0, "y" => 0])]);
     $this->_runner->writeAs("top-crop-{NAME}-{W}")->process("5639.jpg", 100)->run($chain);
     $this->assertTrue(file_exists($this->_runner->getImage()->getFullPath()));
     list($width, $height) = getimagesize($this->_runner->getImage()->getFullPath());
     $this->assertEquals(500, $width);
     $this->assertEquals(250, $height);
 }
Esempio n. 2
0
 public function testGrayscaleRule()
 {
     $chain = new Chain();
     $chain->setRules([new Duplicate(), new Grayscale()]);
     $basePath = __DIR__ . "/image";
     $runner = ChainBuilder::newRunner(["source" => $basePath, "format" => "gs-{NAME}"]);
     $runner->process("5639.jpg", 100)->run($chain);
     $file = glob($basePath . "/gs-5639*");
     $this->assertTrue(file_exists($file[0]));
 }
Esempio n. 3
0
 public function testDuplicateRule()
 {
     $chain = new Chain();
     $chain->setRules([new Duplicate()]);
     $basePath = __DIR__ . "/image";
     $runner = ChainBuilder::newRunner(["source" => $basePath]);
     $runner->process("5639.jpg")->run($chain);
     $file = $runner->getImage()->getFullPath();
     $this->assertTrue(file_exists($file));
     unlink($file);
 }