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])); }
public function testCreatingNewRunnerInstance() { $basePath = __DIR__ . "/image"; $chainRunner = ChainBuilder::newRunner(["source" => $basePath]); $chainRunner->process("5639.jpg")->run(new Chain()); $file = glob($basePath . "/5639-*.jpg"); $this->assertTrue(count($file) === 1); $this->assertTrue(file_exists($file[0])); rename($file[0], $basePath . "/5639.jpg"); }
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); }
public function setup() { $this->_basePath = __DIR__ . "/image"; $this->_runner = ChainBuilder::newRunner(["source" => $this->_basePath, "format" => "thumb-{NAME}"]); }